summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/lua/rocklib.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/apps/plugins/lua/rocklib.c b/apps/plugins/lua/rocklib.c
index d6159e0..c6b399c 100644
--- a/apps/plugins/lua/rocklib.c
+++ b/apps/plugins/lua/rocklib.c
@@ -394,12 +394,22 @@ RB_WRAP(kbd_input)
luaL_Buffer b;
luaL_buffinit(L, &b);
+ const char *input = luaL_optstring(L, 1, NULL);
char *buffer = luaL_prepbuffer(&b);
- buffer[0] = '\0';
- rb->kbd_input(buffer, LUAL_BUFFERSIZE);
- luaL_addsize(&b, strlen(buffer));
- luaL_pushresult(&b);
+ if(input != NULL)
+ rb->strlcpy(buffer, input, LUAL_BUFFERSIZE);
+ else
+ buffer[0] = '\0';
+
+ if(!rb->kbd_input(buffer, LUAL_BUFFERSIZE))
+ {
+ luaL_addsize(&b, strlen(buffer));
+ luaL_pushresult(&b);
+ }
+ else
+ lua_pushnil(L);
+
return 1;
}