Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function GetType(item)
- if type(item) == "string" then
- return "\""..item.."\""
- elseif type(item) == "table" then
- local str = "{"
- local max = 0
- local numb = 1
- for i,v in pairs(item) do
- max = max+1
- end
- for i,v in pairs(item) do
- if numb == max then
- str = str.."["..GetType(i).."] = "..GetType(v)
- else
- str = str.."["..GetType(i).."] = "..GetType(v)..", "
- end
- numb = numb + 1
- end
- str = str.."}"
- return str
- elseif type(item) == "userdata" then
- local a,b = pcall(function()
- return item.ClassName
- end)
- if a then
- return item:GetFullName()
- else
- if tostring(b):match("not a valid member of %w+") then
- local c, d = tostring(b):match("not a valid member of %w+"):find("of ")
- local class = tostring(b):match("not a valid member of %w+"):sub(d+1)
- return class..".new(".. tostring(item) ..")"
- end
- end
- else
- return tostring(item)
- end
- end
- --Credits to Autumn
Advertisement
Add Comment
Please, Sign In to add comment