Advertisement
EconomicSerg

Global

Oct 21st, 2020 (edited)
318
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.33 KB | None | 0 0
  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.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement