BigSHinyToys

dumps info from _G into a file.

Dec 23rd, 2012
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.78 KB | None | 0 0
  1. --[[
  2.         _G profiler
  3.         by BigSHinyToys
  4. ]]--
  5.  
  6. local level = -3
  7. local sSavePath = "gTab"
  8.  
  9. local function save(sSave)
  10.     file = fs.open(sSavePath,"a")
  11.     if file then
  12.         file.write(sSave.."\n")
  13.         file:close()
  14.         return true
  15.     else
  16.         return false
  17.     end
  18. end
  19.  
  20. local function add(tDat)
  21.     level = level + 3
  22.     local tTables = {}
  23.     local tOther = {}
  24.     for k,v in pairs(tDat) do
  25.         if k ~= "_G" then
  26.             if type(v) == "table" then
  27.                 save(string.rep(" ",level).."+ "..tostring(k))
  28.                 add(v)
  29.             else
  30.                 save(string.rep(" ",level).."- "..type(v).." "..tostring(v).." "..tostring(k))
  31.             end
  32.         end
  33.     end
  34.     save("")
  35.     level = level - 3
  36. end
  37.  
  38. fs.delete(sSavePath)
  39. save("ver : "..os.version().." Computer : "..os.getComputerID().." Label : "..(os.getComputerLabel() or ""))
  40. save("")
  41. add(_G)
Add Comment
Please, Sign In to add comment