fix: correct nlua_wait error message #18867

the message is wrapped in `if (timeout < 0)`, which means 0 is a valid value
This commit is contained in:
resolritter
2022-06-09 12:02:32 -03:00
committed by GitHub
parent d189bfaeb2
commit 11e0fea8ba

View File

@@ -357,7 +357,7 @@ static int nlua_wait(lua_State *lstate)
{ {
intptr_t timeout = luaL_checkinteger(lstate, 1); intptr_t timeout = luaL_checkinteger(lstate, 1);
if (timeout < 0) { if (timeout < 0) {
return luaL_error(lstate, "timeout must be > 0"); return luaL_error(lstate, "timeout must be >= 0");
} }
int lua_top = lua_gettop(lstate); int lua_top = lua_gettop(lstate);
@@ -384,7 +384,7 @@ static int nlua_wait(lua_State *lstate)
if (lua_top >= 3 && !lua_isnil(lstate, 3)) { if (lua_top >= 3 && !lua_isnil(lstate, 3)) {
interval = luaL_checkinteger(lstate, 3); interval = luaL_checkinteger(lstate, 3);
if (interval < 0) { if (interval < 0) {
return luaL_error(lstate, "interval must be > 0"); return luaL_error(lstate, "interval must be >= 0");
} }
} }