sol2: LuaJIT 5.1: Exceptions are not rethrown through sol::error
In my code, I’m trying to force some sandboxing, one part of this is setting the require function to nil.
To test this, I create an “library script”:
local M = {}
function M.foo()
return "foo"
end
return M
I store this into a file in the test dir, m.lua, and then load it via:
local M= require('m')
assert(M.foo() == "foo");
On Lua 5.2, this throws a sol::error claiming the require function is nil. This is the expected behaviour, however, luajit exceptions are never caught and it throws an error unrecognized.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 25 (23 by maintainers)
For what it’s worth, you can define
SOL_NO_EXCEPTIONS 1and just let your exceptions tear through the stack without any interference from sol. If it works out, well, have fun.