diff options
| author | Maurus Cuelenaere <mcuelenaere@gmail.com> | 2009-05-22 22:44:34 +0000 |
|---|---|---|
| committer | Maurus Cuelenaere <mcuelenaere@gmail.com> | 2009-05-22 22:44:34 +0000 |
| commit | 0f7e4e36aeb95f3e39a940d6e19748d910d40d92 (patch) | |
| tree | 72df574e93dc33babc1107da581c3b0e30837acc /apps/plugins/lua/rocklib.c | |
| parent | 475b5dc2bbddd31f4fee8935a0e903147e05fd08 (diff) | |
| download | rockbox-0f7e4e36aeb95f3e39a940d6e19748d910d40d92.zip rockbox-0f7e4e36aeb95f3e39a940d6e19748d910d40d92.tar.gz rockbox-0f7e4e36aeb95f3e39a940d6e19748d910d40d92.tar.bz2 rockbox-0f7e4e36aeb95f3e39a940d6e19748d910d40d92.tar.xz | |
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.c | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/apps/plugins/lua/rocklib.c b/apps/plugins/lua/rocklib.c index 99bc44c..c99400c 100644 --- a/apps/plugins/lua/rocklib.c +++ b/apps/plugins/lua/rocklib.c @@ -251,6 +251,19 @@ RB_WRAP(get_action) return 1; } +#ifdef HAVE_TOUCHSCREEN +RB_WRAP(action_get_touchscreen_press) +{ + short x, y; + int result = rb->action_get_touchscreen_press(&x, &y); + + lua_pushinteger(L, result); + lua_pushinteger(L, x); + lua_pushinteger(L, y); + return 3; +} +#endif + RB_WRAP(action_userabort) { int timeout = luaL_checkint(L, 1); @@ -261,10 +274,15 @@ RB_WRAP(action_userabort) RB_WRAP(kbd_input) { - char* buffer = (char*)luaL_checkstring(L, 1); - int buflen = luaL_checkint(L, 2); - int result = rb->kbd_input(buffer, buflen); - lua_pushinteger(L, result); + luaL_Buffer b; + luaL_buffinit(L, &b); + + char *buffer = luaL_prepbuffer(&b); + buffer[0] = '\0'; + rb->kbd_input(buffer, LUAL_BUFFERSIZE); + luaL_addsize(&b, strlen(buffer)); + + luaL_pushresult(&b); return 1; } @@ -467,6 +485,9 @@ static const luaL_Reg rocklib[] = #endif R(get_action), R(action_userabort), +#ifdef HAVE_TOUCHSCREEN + R(action_get_touchscreen_press), +#endif R(kbd_input), /* Hardware */ |