Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function bPassesFilter(str)
- local bool = (
- tostring(str) ~= "__index" and
- tostring(str) ~= "__everyclass" and
- tostring(str) ~= "_G" and
- tostring(str) ~= "__module__"
- )
- return bool
- end
- function outTree(TABLE, key)
- local file = io.open("TreeDump.txt", "w")
- file:close()
- file = io.open("TreeDump.txt", "a+")
- file:write("KEY | "..tostring(key).."\n")
- file:write("input type | "..type(TABLE).."\n")
- file:write("input tostring | "..tostring(TABLE).."\n")
- file:write("input tonumber | "..tostring(tonumber(TABLE)).."\n")
- if type(TABLE) ~= "table" and type(TABLE) ~= "userdata" then
- -- file:write(type(TABLE).."\n")
- -- file:write(tostring(TABLE).."\n")
- log("Tree Error! See TreeDump.txt | " .. tostring(key))
- log("\t TOSTRING | " .. tostring(TABLE))
- return
- elseif type(TABLE) == "userdata" then
- TABLE = getmetatable(TABLE)
- end
- file:write("{}=========="..tostring(TABLE).."=========={}\n")
- local table1 = {}
- local table2 = {}
- local table3 = {}
- for k, v in pairs(TABLE) do
- table1[k] = v
- if v then
- --log(tostring(k))
- file:write(type(v).." | "..tostring(k).."\n")
- if type(v) == "string" or type(v) == "number" or type(v) == "boolean" then
- file:write("\tTOSTRING | "..tostring(v).."\n")
- end
- end
- if type(v) == 'table' and bPassesFilter(k) then
- for k1, v1 in pairs(v) do
- table2[k1] = v1
- if v1 then
- --log(tostring(k1))
- file:write("\t"..type(v1).." | "..tostring(k1).."\n")
- if type(v1) == "string" or type(v1) == "number" or type(v1) == "boolean" then
- file:write("\t\tTOSTRING | "..tostring(v1).."\n")
- end
- end
- if type(v1) == 'table' and bPassesFilter(k1) then
- for k2, v2 in pairs(v1) do
- table3[k2] = v2
- if v2 then
- --log(tostring(k2))
- file:write("\t\t"..type(v2).." | "..tostring(k2).."\n")
- if type(v2) == "string" or type(v2) == "number" or type(v2) == "boolean" then
- file:write("\t\t\tTOSTRING | "..tostring(v2).."\n")
- end
- end
- if type(v2) == 'table' then
- file:write("\t\t\t <<<THERES MORE>>>\n")
- end
- end
- end
- end
- end
- end
- log("Tree Created! See TreeDump.txt | " .. tostring(key))
- file:close()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement