summaryrefslogtreecommitdiff
path: root/apps/plugins/lua/rocklib.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/lua/rocklib.c')
-rw-r--r--apps/plugins/lua/rocklib.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/apps/plugins/lua/rocklib.c b/apps/plugins/lua/rocklib.c
index 8e1ab19941..809b269b47 100644
--- a/apps/plugins/lua/rocklib.c
+++ b/apps/plugins/lua/rocklib.c
@@ -28,6 +28,7 @@
28#include "lauxlib.h" 28#include "lauxlib.h"
29#include "rocklib.h" 29#include "rocklib.h"
30#include "lib/helper.h" 30#include "lib/helper.h"
31#include "lib/pluginlib_actions.h"
31 32
32/* 33/*
33 * http://www.lua.org/manual/5.1/manual.html#lua_CFunction 34 * http://www.lua.org/manual/5.1/manual.html#lua_CFunction
@@ -613,6 +614,24 @@ RB_WRAP(backlight_brightness_set)
613SIMPLE_VOID_WRAPPER(backlight_brightness_use_setting); 614SIMPLE_VOID_WRAPPER(backlight_brightness_use_setting);
614#endif 615#endif
615 616
617RB_WRAP(get_plugin_action)
618{
619 static const struct button_mapping *m1[] = { pla_main_ctx };
620 int timeout = luaL_checkint(L, 1);
621 int btn;
622#ifdef HAVE_REMOTE_LCD
623 static const struct button_mapping *m2[] = { pla_main_ctx, pla_remote_ctx };
624 bool with_remote = luaL_optint(L, 2, 0);
625 if (with_remote)
626 btn = pluginlib_getaction(timeout, m2, 2);
627 else
628#endif
629 btn = pluginlib_getaction(timeout, m1, 1);
630
631 lua_pushinteger(L, btn);
632 return 1;
633}
634
616#define R(NAME) {#NAME, rock_##NAME} 635#define R(NAME) {#NAME, rock_##NAME}
617static const luaL_Reg rocklib[] = 636static const luaL_Reg rocklib[] =
618{ 637{
@@ -670,6 +689,7 @@ static const luaL_Reg rocklib[] =
670 R(backlight_brightness_set), 689 R(backlight_brightness_set),
671 R(backlight_brightness_use_setting), 690 R(backlight_brightness_use_setting),
672#endif 691#endif
692 R(get_plugin_action),
673 693
674 {"new_image", rli_new}, 694 {"new_image", rli_new},
675 695