This commit is contained in:
BADIM-PC\Vadim 2017-12-29 19:20:37 +03:00
parent 16ba85425d
commit d20232d673
2 changed files with 8 additions and 8 deletions

View File

@ -276,13 +276,13 @@ static s32 duk_keyp(duk_context* duk)
if(key >= TIC_KEYS_COUNT)
{
duk_error(duk, DUK_ERR_ERROR, "unknown keyboard code\n");
return 0;
}
else
{
if(duk_is_null_or_undefined(duk, 1) && duk_is_null_or_undefined(duk, 2))
{
duk_push_boolean(duk, tic->api.keyp(tic, key, -1, -1));
return 1;
}
else
{
@ -290,12 +290,11 @@ static s32 duk_keyp(duk_context* duk)
u32 period = duk_to_int(duk, 2);
duk_push_boolean(duk, tic->api.keyp(tic, key, hold, period));
return 1;
}
}
}
return 0;
return 1;
}
static duk_ret_t duk_sfx(duk_context* duk)

View File

@ -836,8 +836,6 @@ static s32 lua_keyp(lua_State* lua)
if(top == 1)
{
lua_pushboolean(lua, tic->api.keyp(tic, key, -1, -1));
return 1;
}
else if(top == 3)
{
@ -845,13 +843,16 @@ static s32 lua_keyp(lua_State* lua)
u32 period = getLuaNumber(lua, 3);
lua_pushboolean(lua, tic->api.keyp(tic, key, hold, period));
return 1;
}
else luaL_error(lua, "invalid params, keyp [ code [ hold period ] ]\n");
else
{
luaL_error(lua, "invalid params, keyp [ code [ hold period ] ]\n");
return 0;
}
}
}
return 0;
return 1;
}
static s32 lua_memcpy(lua_State* lua)