AdUki / LuaState

Lua51-52 binding library
Apache License 2.0
77 stars 14 forks source link

Exception from destructor #3

Closed AdUki closed 10 years ago

AdUki commented 10 years ago

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) {
}