Guest User

test

a guest
Jul 25th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.68 KB | None | 0 0
  1. local function copyTable(...)
  2.     local tArgs={...}
  3.     local rtrn = {}
  4.     local tbl = tArgs[1]
  5.     if not type(tbl) == "table" then
  6.         error("Argument 1 must be a table!")
  7.     end
  8.     local copied = tArgs[2] or {}
  9.     for k, v in pairs(tArgs[1]) do
  10.         if copied[tostring(k)] == nil then
  11.             if type(tbl[k]) == "table" then
  12.                 copied[tostring(k)] = true
  13.                 rtrn[k] = copyTable(tbl[k], copied)
  14.             else
  15.                 rtrn[k] = v
  16.                 copied[tostring(k)] = true
  17.             end
  18.         end
  19.     end
  20.     return rtrn
  21. end
  22. _G.myENV = copyTable(_ENV)
  23. _G.myENV.fs.copy = function() error(true) end
  24. _G.myENV.fs.copy()
Advertisement
Add Comment
Please, Sign In to add comment