Skip to content

Instantly share code, notes, and snippets.

@zhuizhuhaomeng
Last active March 20, 2022 14:40
Show Gist options
  • Save zhuizhuhaomeng/d2b98a6fe896de293bea96779b6997a0 to your computer and use it in GitHub Desktop.
Save zhuizhuhaomeng/d2b98a6fe896de293bea96779b6997a0 to your computer and use it in GitHub Desktop.
[ljl@localhost ~]$ cat t.lua
local array = {"Google", "Runoob"}
for key,value in ipairs(array)
do
print(key, value)
end
[ljl@localhost ~]$ luajit -bL t.lua
-- BYTECODE -- t.lua:0-6
KGC 0 table
KGC 1 "ipairs"
KGC 2 "print"
0001 [1] TDUP 0 0
0002 [2] GGET 1 1 ; "ipairs"
0003 [2] MOV 3 0
0004 [2] CALL 1 4 2
0005 [3] JMP 4 => 0010
0006 [4] => GGET 6 2 ; "print"
0007 [4] MOV 8 4
0008 [4] MOV 9 5
0009 [4] CALL 6 1 3
0010 [2] => ITERC 4 3 3
0011 [2] ITERL 4 => 0006
0012 [5] RET0 0 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment