summaryrefslogtreecommitdiff
path: root/apps/plugins/lua/rocklib.c
diff options
context:
space:
mode:
authorMaurus Cuelenaere <mcuelenaere@gmail.com>2009-05-22 22:44:34 +0000
committerMaurus Cuelenaere <mcuelenaere@gmail.com>2009-05-22 22:44:34 +0000
commit0f7e4e36aeb95f3e39a940d6e19748d910d40d92 (patch)
tree72df574e93dc33babc1107da581c3b0e30837acc /apps/plugins/lua/rocklib.c
parent475b5dc2bbddd31f4fee8935a0e903147e05fd08 (diff)
downloadrockbox-0f7e4e36aeb95f3e39a940d6e19748d910d40d92.tar.gz
rockbox-0f7e4e36aeb95f3e39a940d6e19748d910d40d92.zip
Lua:
* add action_get_touchscreen_press wrapper * fix kbd_input wrapper * rework luaL_loadfile * add rb.contexts git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21046 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/lua/rocklib.c')
-rw-r--r--apps/plugins/lua/rocklib.c29
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
255RB_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
254RB_WRAP(action_userabort) 267RB_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
262RB_WRAP(kbd_input) 275RB_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 */