When calling lua::Function whitout assigning to value, it is done by calling function from destructor and to from operator=. Problem is while using protectedCall() because that can throw an exception. Don't know if this can be resolved.
Workaround: Explicitly call execute() function of lua::Function
state.doString("badFnc = function(a,b) local var = a .. b end");
try {
state["badFnc"].protectedCall(3).execute();
assert(false);
} catch (lua::RuntimeError ex) {
}
When calling
lua::Function
whitout assigning to value, it is done by calling function from destructor and to fromoperator=
. Problem is while usingprotectedCall()
because that can throw an exception. Don't know if this can be resolved.Workaround: Explicitly call
execute()
function oflua::Function