Advertisement
SlyHades66

Arguments Finder (Edit)

Aug 6th, 2016
378
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.66 KB | None | 0 0
  1. local meta,oldmeta = getrawmetatable(game),{}
  2. for i,v in next,meta do oldmeta[i] = v end
  3. function formatargs(args,showkeys)
  4.     if #args == 0 then return "N/A" end
  5.     local strargs = {}
  6.     for k,v in next,args do
  7.         local argstr = ""
  8.         if type(v) == "string" then
  9.             argstr = "\"" .. v .. "\""
  10.         elseif typeof(v) == "Instance" then
  11.             argstr = "game."..v:GetFullName()
  12.         elseif type(v) == "table" then
  13.             argstr = "{" .. formatargs(v,true) .. "}"
  14.         else
  15.             argstr = tostring(v)
  16.         end
  17.         if showkeys and type(k) ~= "number" then
  18.             table.insert(strargs,k.."="..argstr)
  19.         else
  20.             table.insert(strargs,argstr)
  21.         end
  22.     end
  23.     return table.concat(strargs, ", ")
  24. end
  25. local realmethods = {}
  26. realmethods.FireServer = Instance.new("RemoteEvent").FireServer
  27. realmethods.InvokeServer = Instance.new("RemoteFunction").InvokeServer
  28.  
  29. local tables = ""
  30. meta.__index = function(t,k)
  31.     if k == "FireServer" or k == "InvokeServer" then
  32.         return function(self,...)
  33.             local args = {...}
  34.             local ret = {realmethods[k](self,...)}
  35.             warn(t.ClassName.." called!\nPath: game."..t:GetFullName().."\n".."Arguments: "..formatargs(args).."\nReturn: "..formatargs(ret).."\nRuns As: ".."game."..t:GetFullName()..":"..k.."("..formatargs(args)..")")
  36.             --tables = tables..(t.ClassName.." called!\nPath: ".."game."..t:GetFullName().."\n".."Args: "..formatargs(args).."\nReturn: "..formatargs(ret).."\nRuns As: ".."game."..t:GetFullName()..":"..k.."("..formatargs(args)..")")
  37.             return unpack(ret)
  38.         end
  39.     else
  40.         return oldmeta.__index(t,k)
  41.     end
  42. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement