Vm Merge |
|
luac
to generate the Lua VM code, and merge the two together.
eg. Using the following code :-
a = {}
b = a.x
print(b)
luac
produces :-
main <0:@a.lua> (9 instructions/36 bytes at 002F29E8) 0 params, 2 stacks, 0 locals, 4 strings, 0 numbers, 0 functions, 5 lines 1 [2] CREATETABLE 0 2 [2] SETGLOBAL 0 ; a 3 [3] GETGLOBAL 0 ; a 4 [3] GETDOTTED 2 ; x 5 [3] SETGLOBAL 1 ; b 6 [4] GETGLOBAL 3 ; print 7 [4] GETGLOBAL 1 ; b 8 [4] CALL 0 0 9 [4] END
a = {} CREATETABLE 0 SETGLOBAL 0 ; a b = a.x GETGLOBAL 0 ; a GETDOTTED 2 ; x SETGLOBAL 1 ; b print(b) GETGLOBAL 3 ; print GETGLOBAL 1 ; b CALL 0 0 END
<html><pre> <b>a = {}</b> CREATETABLE 0 SETGLOBAL 0 ; a <b>b = a.x</b> GETGLOBAL 0 ; a GETDOTTED 2 ; x SETGLOBAL 1 ; b <b>print(b)</b> GETGLOBAL 3 ; print GETGLOBAL 1 ; b CALL 0 0 END</pre></html>
Note, the above example is without line numbers. You can find some more examples on OptimisationTips page.
lua -f vmmerge.lua ...options...
lua
and luac
executables in your path. luac -p -l
is used to generated the VM code.
--fmt merge|html
chooses output format (see above).
--nol
removes line numbers
... > file.txt
"
lua -f vmmerge.lua --file my.lua --fmt html > my.html