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.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/apps/plugins/lua/rocklua.c b/apps/plugins/lua/rocklua.c
index 3909f3008f..3cf0fce945 100644
--- a/apps/plugins/lua/rocklua.c
+++ b/apps/plugins/lua/rocklua.c
@@ -175,9 +175,10 @@ static int loadfile_newstate(lua_State **L, const char *filename)
175static void lua_atexit(void) 175static void lua_atexit(void)
176{ 176{
177 char *filename; 177 char *filename;
178 178 int err_n;
179 if(Ls && lua_gettop(Ls) > 1) 179 if(Ls && lua_gettop(Ls) > 1)
180 { 180 {
181 err_n = lua_tointeger(Ls, -1); /* os.exit? */
181 if (Ls == lua_touserdata(Ls, -1)) /* signal from restart_lua */ 182 if (Ls == lua_touserdata(Ls, -1)) /* signal from restart_lua */
182 { 183 {
183 filename = (char *) malloc((MAX_PATH * 2) + 1); 184 filename = (char *) malloc((MAX_PATH * 2) + 1);
@@ -195,7 +196,12 @@ static void lua_atexit(void)
195 free(filename); 196 free(filename);
196 plugin_start(NULL); 197 plugin_start(NULL);
197 } 198 }
198 else if (lua_tointeger(Ls, -1) != 0) /* os.exit */ 199 else if (err_n >= PLUGIN_USB_CONNECTED) /* INTERNAL PLUGIN RETVAL */
200 {
201 lua_close(Ls);
202 _exit(err_n); /* don't call exit handler */
203 }
204 else if (err_n != 0)
199 { 205 {
200ERR_RUN: 206ERR_RUN:
201 lu_status = LUA_ERRRUN; 207 lu_status = LUA_ERRRUN;
@@ -205,7 +211,7 @@ ERR_RUN:
205 else 211 else
206 lua_close(Ls); 212 lua_close(Ls);
207 } 213 }
208 _exit(0); /* don't call exit handler */ 214 _exit(PLUGIN_OK); /* don't call exit handler */
209} 215}
210 216
211/* split filename at argchar 217/* split filename at argchar