mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
made "error" accessible in the Lua state
We need to expose `error()` in Lua in order to let it call the error handler function. However, for that the base library needs to be available in the Lua state. Without this fix the output of the program is `call failed, sol::error::what() is Handled this message: [string "..."]:7: attempt to call a nil value (global 'error')` while it's supposed to be `call failed, sol::error::what() is Handled this message: [string "..."]:7: negative number detected`
This commit is contained in:
parent
3d5f80e35a
commit
eebda40507
|
@ -7,6 +7,7 @@ int main() {
|
|||
std::cout << "=== protected_functions example ===" << std::endl;
|
||||
|
||||
sol::state lua;
|
||||
lua.open_libraries(sol::lib::base);
|
||||
|
||||
// A complicated function which can error out
|
||||
// We define both in terms of Lua code
|
||||
|
|
Loading…
Reference in New Issue
Block a user