Update LuaEngine.h

Made the error to return right amount of nils in any case.
This commit is contained in:
Rochet2
2014-05-26 00:28:27 +03:00
committed by Foereaper
parent 9873293b17
commit 18258079b2

View File

@@ -273,12 +273,8 @@ public:
int args = lua_gettop(L); int args = lua_gettop(L);
int expected = l->mfunc(L, obj); int expected = l->mfunc(L, obj);
args = lua_gettop(L) - args; args = lua_gettop(L) - args;
if (args <= 0 || args > expected)
{
if (args < 0 || args > expected) // Assert instead? if (args < 0 || args > expected) // Assert instead?
ELUNA_LOG_ERROR("[Eluna]: %s returned unexpected amount of arguments %i out of %i. Report to devs", l->name, args, expected); ELUNA_LOG_ERROR("[Eluna]: %s returned unexpected amount of arguments %i out of %i. Report to devs", l->name, args, expected);
return expected;
}
for (; args < expected; ++args) for (; args < expected; ++args)
lua_pushnil(L); lua_pushnil(L);
return expected; return expected;