summaryrefslogtreecommitdiff
path: root/apps/plugins/lua
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/lua')
-rw-r--r--apps/plugins/lua/lua.make2
-rw-r--r--apps/plugins/lua/rocklua.c17
2 files changed, 18 insertions, 1 deletions
diff --git a/apps/plugins/lua/lua.make b/apps/plugins/lua/lua.make
index c85182880b..a5d1813a8b 100644
--- a/apps/plugins/lua/lua.make
+++ b/apps/plugins/lua/lua.make
@@ -40,7 +40,7 @@ $(LUA_BUILDDIR)/settings.lua: $(LUA_OBJ) $(LUA_SRCDIR)/settings_helper.pl
40 40
41HOST_INCLUDES := $(filter-out %/libc/include,$(INCLUDES)) 41HOST_INCLUDES := $(filter-out %/libc/include,$(INCLUDES))
42$(LUA_BUILDDIR)/buttons.lua: $(LUA_OBJ) $(LUA_SRCDIR)/button_helper.pl 42$(LUA_BUILDDIR)/buttons.lua: $(LUA_OBJ) $(LUA_SRCDIR)/button_helper.pl
43 $(SILENT)$(CC) $(INCLUDES) $(TARGET) $(CFLAGS) -dM -E -P -include button-target.h - < /dev/null | $(LUA_SRCDIR)/button_helper.pl | $(HOSTCC) $(TARGET) -fno-builtin $(HOST_INCLUDES) -x c -o $(LUA_BUILDDIR)/button_helper - 43 $(SILENT)$(CC) $(INCLUDES) $(TARGET) $(CFLAGS) -dM -E -P -include button-target.h - < /dev/null | $(LUA_SRCDIR)/button_helper.pl | $(HOSTCC) $(TARGET) -fno-builtin $(HOST_INCLUDES) $(EXTRA_DEFINES) -x c -o $(LUA_BUILDDIR)/button_helper -
44 $(call PRINTS,GEN $(@F))$(LUA_BUILDDIR)/button_helper > $(LUA_BUILDDIR)/buttons.lua 44 $(call PRINTS,GEN $(@F))$(LUA_BUILDDIR)/button_helper > $(LUA_BUILDDIR)/buttons.lua
45 45
46$(LUA_BUILDDIR)/rb_defines.lua: $(LUA_OBJ) $(LUA_SRCDIR)/rbdefines_helper.pl 46$(LUA_BUILDDIR)/rb_defines.lua: $(LUA_OBJ) $(LUA_SRCDIR)/rbdefines_helper.pl
diff --git a/apps/plugins/lua/rocklua.c b/apps/plugins/lua/rocklua.c
index 3cf0fce945..650c4d6dae 100644
--- a/apps/plugins/lua/rocklua.c
+++ b/apps/plugins/lua/rocklua.c
@@ -241,6 +241,20 @@ static void display_traceback(const char *errstr)
241 rb->splash(10 * HZ, errstr); 241 rb->splash(10 * HZ, errstr);
242#endif 242#endif
243} 243}
244
245int browse_scripts(void)
246{
247 static char buf[MAX_PATH];
248 const char *fname = rb->plugin_get_current_filename();
249 /* strip plugin dir to save space in the param buffer */
250 if (rb->strncmp(fname, PLUGIN_DIR, sizeof(PLUGIN_DIR) - 1) == 0)
251 fname += sizeof(PLUGIN_DIR) - 1; /* leave slash */
252 /* -r return to this plugin, -f looking for lua files,
253 -s start in lua_scripts, -d lock to that directory */
254 snprintf(buf, sizeof(buf), "-r'%s'-f'.lua'-s'%s'-d",
255 fname, PLUGIN_DEMOS_DIR"/lua_scripts/");
256 return rb->plugin_open(VIEWERS_DIR "/file_picker.rock", buf);
257}
244/***************** Plugin Entry Point *****************/ 258/***************** Plugin Entry Point *****************/
245enum plugin_status plugin_start(const void* parameter) 259enum plugin_status plugin_start(const void* parameter)
246{ 260{
@@ -249,7 +263,10 @@ enum plugin_status plugin_start(const void* parameter)
249 if (parameter == NULL) 263 if (parameter == NULL)
250 { 264 {
251 if (!Ls) 265 if (!Ls)
266 {
252 rb->splash(HZ, "Play a .lua file!"); 267 rb->splash(HZ, "Play a .lua file!");
268 return browse_scripts();
269 }
253 } 270 }
254 else 271 else
255 { 272 {