qwopqwoqpwqwop

somefuncs

Nov 2nd, 2018
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 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. function getargs(event, method, Table)
  40. local max = 0
  41. local numb = 1
  42. local argz = {}
  43. local script = "\n-------R2S-------\n--This was made with my shitty RS\n\n\n";
  44. local arg_num = 1
  45. local list = ""
  46. for i,v in pairs(Table) do
  47. max = max + 1
  48. arg_num = arg_num + 1
  49. end
  50.  
  51. for i,v in pairs(Table) do
  52. script = script.. "local A_"..i.." = "..GetType(v).."\n"
  53. table.insert(argz,"A_"..i)
  54. end
  55. script = script.."local Event = "..event.."\n\n".."Event:"..method.."("..table.concat(argz,", ")..")".."\n\n-------R2S-------"
  56. print(script)
  57.  
  58. for i,v in pairs(Table) do
  59. if numb == max then
  60. list = list..GetType(v)
  61. else
  62. list = list..GetType(v)..", "
  63. end
  64. numb = numb + 1
  65. end
  66. return event..":"..method.."("..list..")";
  67. end
Advertisement
Add Comment
Please, Sign In to add comment