In Python you have the ability to view the compiled bytecode of a user-defined function using dis
.
Is there a builtin equivalent to this for Lua?
It would really useful!
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:...>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With