summaryrefslogtreecommitdiff
path: root/apps/plugins/lua/rocklua.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/lua/rocklua.c')
-rw-r--r--apps/plugins/lua/rocklua.c17
1 files changed, 17 insertions, 0 deletions
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 {