Modify system.wait_event to wait indefinitely if no timeout is given

This commit is contained in:
Francesco Abbate 2020-06-16 14:53:01 +02:00
parent f5ede27e91
commit 5c3d4163d3
1 changed files with 7 additions and 2 deletions

View File

@ -133,8 +133,13 @@ top:
static int f_wait_event(lua_State *L) {
double n = luaL_checknumber(L, 1);
lua_pushboolean(L, SDL_WaitEventTimeout(NULL, n * 1000));
int nargs = lua_gettop(L);
if (nargs >= 1) {
double n = luaL_checknumber(L, 1);
lua_pushboolean(L, SDL_WaitEventTimeout(NULL, n * 1000));
} else {
lua_pushboolean(L, SDL_WaitEvent(NULL));
}
return 1;
}