Closed DominikMS closed 10 years ago
I can't help you here. I don't even know what Sandboxing means in terms of Lua. I'm not even sure this is related to sol
: we don't provide debugging and helpdesking for general Lua issues. If you're trying to make a feature-request to support "Sandboxing", whatever that is supposed to be in this situation, please be more clear about that. If this is just a general Lua question, I can't help you.
Lua 5.2 removed that method of sandboxing. I don't plan on supporting the other much more verbose way of sandboxing any time soon and I never plan on supporting Lua 5.1.
You can do it yourself. See here for more details: http://stackoverflow.com/a/6982080/1381108
sol::state
has a member function to return the managed state, lua_state
. So you can do what you want manually on the Lua side if you feel something is missing. The only gotcha is that you can't delete it because it's managed internally by sol::state
.
I have do it in lua, now is easy to add this to c++. Thread can be closed.
g_test = setmetatable({}, { __index = _G })
loadfile("script2.lua", "g_test", g_test)()
Sandboxing is very usefull while you want to load more than one file (ex. for handlers, callbacks). This code is not working under 5.2, function lua_setfenv is missing.