diff options
Diffstat (limited to 'apps/plugins/lua/rocklib.c')
-rw-r--r-- | apps/plugins/lua/rocklib.c | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/apps/plugins/lua/rocklib.c b/apps/plugins/lua/rocklib.c index 99bc44c9a4..c99400c938 100644 --- a/apps/plugins/lua/rocklib.c +++ b/apps/plugins/lua/rocklib.c | |||
@@ -251,6 +251,19 @@ RB_WRAP(get_action) | |||
251 | return 1; | 251 | return 1; |
252 | } | 252 | } |
253 | 253 | ||
254 | #ifdef HAVE_TOUCHSCREEN | ||
255 | RB_WRAP(action_get_touchscreen_press) | ||
256 | { | ||
257 | short x, y; | ||
258 | int result = rb->action_get_touchscreen_press(&x, &y); | ||
259 | |||
260 | lua_pushinteger(L, result); | ||
261 | lua_pushinteger(L, x); | ||
262 | lua_pushinteger(L, y); | ||
263 | return 3; | ||
264 | } | ||
265 | #endif | ||
266 | |||
254 | RB_WRAP(action_userabort) | 267 | RB_WRAP(action_userabort) |
255 | { | 268 | { |
256 | int timeout = luaL_checkint(L, 1); | 269 | int timeout = luaL_checkint(L, 1); |
@@ -261,10 +274,15 @@ RB_WRAP(action_userabort) | |||
261 | 274 | ||
262 | RB_WRAP(kbd_input) | 275 | RB_WRAP(kbd_input) |
263 | { | 276 | { |
264 | char* buffer = (char*)luaL_checkstring(L, 1); | 277 | luaL_Buffer b; |
265 | int buflen = luaL_checkint(L, 2); | 278 | luaL_buffinit(L, &b); |
266 | int result = rb->kbd_input(buffer, buflen); | 279 | |
267 | lua_pushinteger(L, result); | 280 | char *buffer = luaL_prepbuffer(&b); |
281 | buffer[0] = '\0'; | ||
282 | rb->kbd_input(buffer, LUAL_BUFFERSIZE); | ||
283 | luaL_addsize(&b, strlen(buffer)); | ||
284 | |||
285 | luaL_pushresult(&b); | ||
268 | return 1; | 286 | return 1; |
269 | } | 287 | } |
270 | 288 | ||
@@ -467,6 +485,9 @@ static const luaL_Reg rocklib[] = | |||
467 | #endif | 485 | #endif |
468 | R(get_action), | 486 | R(get_action), |
469 | R(action_userabort), | 487 | R(action_userabort), |
488 | #ifdef HAVE_TOUCHSCREEN | ||
489 | R(action_get_touchscreen_press), | ||
490 | #endif | ||
470 | R(kbd_input), | 491 | R(kbd_input), |
471 | 492 | ||
472 | /* Hardware */ | 493 | /* Hardware */ |