Skip to content

Commit

Permalink
cleaner code
Browse files Browse the repository at this point in the history
  • Loading branch information
rpatters1 committed Mar 17, 2024
1 parent 6c26d46 commit 5f93250
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions Source/LuaBridge/detail/Invoke.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,14 +199,7 @@ LuaResult callWithHandler(const LuaRef& object, F&& errorHandler, Args&&... args
}
}

int errorFunction = 0;
if constexpr (isValidHandler)
{
if (isNonNullHandler)
errorFunction = (-static_cast<int>(sizeof...(Args)) - 2);
}

const int code = lua_pcall(L, sizeof...(Args), LUA_MULTRET, errorFunction);
const int code = lua_pcall(L, sizeof...(Args), LUA_MULTRET, isNonNullHandler ? (-static_cast<int>(sizeof...(Args)) - 2) : 0);
if (code != LUABRIDGE_LUA_OK)
{
auto ec = makeErrorCode(ErrorCode::LuaFunctionCallFailed);
Expand Down

0 comments on commit 5f93250

Please sign in to comment.