Getting return values from LuaFunction::EndCall?

Hey there,
in the documentation of LuaFunction::EndCall it says

bool EndCall (int numReturns=0)
End call and actually execute the function. The return values, if any, are still left in the stack when this call returns.

But I don’t really see any way to retrieve these values from the stack. Neither with LuaFunction nor LuaScriptInstance.
Was this just never implemented? I could get a return value by writing into a passed parameter, but I’m wondering if the proper way is possible as well.

You can retrieve it from the lua_state:

You can get the Lua state using LuaScript::GetState

1 Like

Thanks! So Urho3D just doesn’t have an abstraction implemented for this and I have to work with the raw interface, got it.

E.g. like this after EndCall.

double retNum = lua_tonumber(scriptSystem->GetState(), -1);
lua_pop(scriptSystem->GetState(), 1);