private static void SetupSandBox() { LuaVM.DoString("Interpreter = {}"); LuaVM.DoString("luanet.load_assembly('WOTV')"); LuaVM.DoString("Interpreter.Gamemode = luanet.import_type('WOTV.Interface.Gamemode')"); LuaVM.DoString("ro = newtag() function readonly(value) local t = {value=value} settag(t, ro) return t end"); LuaVM.DoString("settagmethod(ro, \"setglobal\", function(x) error(x..\" is read only.\") end)"); LuaVM.DoString("function protect(table) return setmetatable({}, { __index = table, __newindex = function(table, key, value) error(\"attempted to modify a read only table\") end, __metatable = false }) end"); LuaVM.DoString("luanet = nil"); LuaVM.DoString("package = nil"); LuaVM.DoString("require = function() print(\"Warning: plugin attempted to call require but the request was blocked.\") end"); LuaVM.DoString("module = nil"); LuaVM.DoString("rawequal = nil"); LuaVM.DoString("rawget = nil"); LuaVM.DoString("rawset = nil"); LuaVM.DoString("setfenv = nil"); LuaVM.DoString("setmetatable = nil"); LuaVM.DoString("debug = nil"); LuaVM.DoString("newproxy = nil"); LuaVM.DoString("collectgarbage=nil"); LuaVM.DoString("dofile = nil"); LuaVM.DoString("getfenv = nil"); LuaVM.DoString("getmetatable = nil"); LuaVM.DoString("load = nil"); LuaVM.DoString("loadfile = nil"); LuaVM.DoString("loadstring = nil"); LuaVM.DoString("os = nil"); LuaVM.DoString("io = nil"); LuaVM.DoString("_G = Interpreter"); }