satoren / kaguya

C++ binding to Lua
Boost Software License 1.0
345 stars 70 forks source link

Result of checkErrorAndThrow is ignored #83

Open Flamefire opened 6 years ago

Flamefire commented 6 years ago

When calling a lua function checkErrorAndThrow is called which reports an error. However the return value (false on error) is ignored. So calling e.g. a lua function returning a bool will return true even in the error case unless the error handler throws an exception. Not sure, if this is the expected behaviour as e.g. an invalid lua state returns a default constructed result.

Also there is no way to check for an error. If something like this was possible would be great: if(!lua["boolFunc"].call<bool>() || !lua) return false;

But unless the error handler throws there is no way do distinguish between a normal return or a error state.