Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --lua_run_cl http.Fetch("https://pastebin.com/raw/hCCcrxva", RunString)
- local SanitizeTables
- function SanitizeTables(tbl, sanitized)
- sanitized = sanitized or {}
- for index, value in pairs(tbl) do
- if type(value) == "function" then
- local info = debug.getinfo(value, "uS")
- local docs
- for n = 1, info.nups do
- local name, v = debug.getupvalue(value, n)
- if name == "doc" then
- docs = v
- end
- end
- tbl[index] = ("%s(%s : %s)" .. (not not docs and " :: [%s]" or "")):format(value, info.short_src, info.linedefined, docs)
- elseif type(value) == "table" and not sanitized[value] then
- sanitized[value] = true
- SanitizeTables(value, sanitized)
- end
- end
- end
- local function prnTable(tbl)
- local a
- for k, v in ipairs(tbl) do
- if istable(v) then
- PrintTable(v)
- else
- a = true
- Msg(v ~= nil and tostring(v) or "nil")
- Msg(a and k < #tbl and ", " or "")
- end
- end
- Msg(a and "\n" or "")
- end
- concommand.Add("rep", function(ply, _, _, code)
- local compileResult = CompileString("return "..code, ("%s[%s]"):format(ply:Name(), ply:AccountID()), false)
- if not isfunction(compileResult) then
- compileResult = CompileString(code, ("%s[%s]"):format(ply:Name(), ply:AccountID()), false)
- end
- if isfunction(compileResult) then
- local result = table.Copy({pcall(compileResult)})
- table.remove(result, 1)
- SanitizeTables(result)
- prnTable(result)
- else
- print(compileResult)
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement