qwopqwoqpwqwop

okthingsineed

Nov 1st, 2018
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. function GetType(item)
  2. if type(item) == "string" then
  3. return "\""..item.."\""
  4. elseif type(item) == "table" then
  5. local str = "{"
  6. local max = 0
  7. local numb = 1
  8. for i,v in pairs(item) do
  9. max = max+1
  10. end
  11. for i,v in pairs(item) do
  12. if numb == max then
  13. str = str.."["..GetType(i).."] = "..GetType(v)
  14. else
  15. str = str.."["..GetType(i).."] = "..GetType(v)..", "
  16. end
  17. numb = numb + 1
  18. end
  19. str = str.."}"
  20. return str
  21. elseif type(item) == "userdata" then
  22. local a,b = pcall(function()
  23. return item.ClassName
  24. end)
  25. if a then
  26. return item:GetFullName()
  27. else
  28. if tostring(b):match("not a valid member of %w+") then
  29. local c, d = tostring(b):match("not a valid member of %w+"):find("of ")
  30. local class = tostring(b):match("not a valid member of %w+"):sub(d+1)
  31. return class..".new(".. tostring(item) ..")"
  32. end
  33. end
  34. else
  35. return tostring(item)
  36. end
  37. end
  38.  
  39. --Credits to Autumn
Advertisement
Add Comment
Please, Sign In to add comment