Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function createSandbox()
- --local sb_apis_user_wl = {"redstone", "gps", "_VERSION", "keys",}
- local sb_apis_user_bl = {getfenv = true, user = true, KilOS = true}
- local sb_apis_root_bl = {}
- local root = user.getName() == "root"
- sandbox = {}
- if root then
- for k, v in pairs(_G) do
- sandbox[v] = v
- end
- else
- for k, v in pairs(_G) do
- if not sb_apis_user_bl[k] then
- sandbox[v] = _G[v]
- end
- end
- sandbox.getfenv = function(f)
- return sandbox
- end
- sandbox.dofile = function(file)
- local f = loadfile()
- setfenv(f, sandbox)
- f()
- end
- sandbox.user = nil
- --sandbox.user = {["getName"] = user.getName}
- --for k, v in pairs(user) do write(k..", ") end print()
- sandbox._G = sandbox
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement