首页 > 解决方案 > 操作码(Lua 字节码)后面的数字是什么意思?

问题描述

LOADK,SETGLOBAL CALL等后面的数字是什么意思?

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

    主要(6 条指令,24 字节在 004784F8)
    0+ 参数、2 个插槽、0 个上值、0 个局部变量、4 个常量、0 个函数
            1 [1] 加载K 0 -2 ; 18
            2 [1] 设置全局 0 -1 ; 一个
            3 [2] 获取全球 0 -3 ; 打印
            4 [2] 加载K 1 -4 ; “你好世界”
            5 [2] 呼叫 0 2 1
            6 [2] 返回 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

这些数字似乎指向18"hello world",但是这些常量存储在哪里?

标签: cluabytecode

解决方案


推荐阅读