Lua等同于Python dis()吗? [英] Lua equivalent to Python dis()?
本文介绍了Lua等同于Python dis()吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Python中,您可以使用dis
查看用户定义函数的已编译字节码.
In Python you have the ability to view the compiled bytecode of a user-defined function using dis
.
Lua是否具有与此等效的内置功能?
Is there a builtin equivalent to this for Lua?
这真的很有用!
推荐答案
标准lua附带的luac
实用程序可以使用其-l
选项从Lua源代码创建程序集列表.例如,从stdin
上的源代码编译:
The luac
utility that comes with standard lua can create an assembly listing from Lua source using its -l
option. For example, compiling from source on stdin
:
C:...> echo a=b | luac -l -
main (3 instructions, 12 bytes at 00334C30)
0+ params, 2 slots, 0 upvalues, 0 locals, 2 constants, 0 functions
1 [1] GETGLOBAL 0 -2 ; b
2 [1] SETGLOBAL 0 -1 ; a
3 [1] RETURN 0 1
C:...>
这篇关于Lua等同于Python dis()吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文