Modify system.wait_event to wait indefinitely if no timeout is given
This commit is contained in:
parent
f5ede27e91
commit
5c3d4163d3
|
@ -133,8 +133,13 @@ top:
|
||||||
|
|
||||||
|
|
||||||
static int f_wait_event(lua_State *L) {
|
static int f_wait_event(lua_State *L) {
|
||||||
double n = luaL_checknumber(L, 1);
|
int nargs = lua_gettop(L);
|
||||||
lua_pushboolean(L, SDL_WaitEventTimeout(NULL, n * 1000));
|
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;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue