zhaoyun
zhaoyun

Reputation: 11

What does numbers after opcode (Lua bytecode) mean?

What do the numbers after LOADK, SETGLOBAL CALL, etc. mean?

E:\Project\ZhScheme\lua>luac -l luac.out

    main  (6 instructions, 24 bytes at 004784F8)
    0+ params, 2 slots, 0 upvalues, 0 locals, 4 constants, 0 functions
            1       [1]     LOADK           0 -2    ; 18
            2       [1]     SETGLOBAL       0 -1    ; a
            3       [2]     GETGLOBAL       0 -3    ; print
            4       [2]     LOADK           1 -4    ; "hello world"
            5       [2]     CALL            0 2 1
            6       [2]     RETURN          0 1

https://the-ravi-programming-language.readthedocs.io/en/latest/lua_bytecode_reference.html

http://files.catwell.info/misc/mirror/lua-5.2-bytecode-vm-dirk-laurie/lua52vm.html

It seems these numbers point to 18 and "hello world", but where are these constant stored?

Upvotes: 1

Views: 542

Answers (0)

Related Questions