Fri, 19 Nov 2010 16:04:30 +0000
New Lua<->native function interface, simpler. Added type() to baselib.
57 | 1 | -- globals.lua |
2 | -- show all global variables | |
3 | ||
4 | local seen={} | |
5 | ||
6 | function dump(t,i) | |
7 | seen[t]=true | |
8 | local s={} | |
9 | local n=0 | |
10 | for k in pairs(t) do | |
11 | n=n+1 s[n]=k | |
12 | end | |
13 | table.sort(s) | |
14 | for k,v in ipairs(s) do | |
15 | print(i,v) | |
16 | v=t[v] | |
17 | if type(v)=="table" and not seen[v] then | |
18 | dump(v,i.."\t") | |
19 | end | |
20 | end | |
21 | end | |
22 | ||
23 | dump(_G,"") | |
24 |