about summary refs log tree commit diff stats
path: root/src/lua.c
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-03-07 15:34:20 -0800
committerKartik K. Agaram <vc@akkartik.com>2022-03-07 15:34:20 -0800
commitcfb7cff4c111959779710d0c8a9a89f108a9e8d1 (patch)
treef2067358e3c1d804db119839f578062187b4b308 /src/lua.c
parente07fa910bb629f50d4da68058ccfcafb4efa60dc (diff)
downloadteliva-cfb7cff4c111959779710d0c8a9a89f108a9e8d1.tar.gz
call app's main() from within Lua pmain
Diffstat (limited to 'src/lua.c')
-rw-r--r--src/lua.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/lua.c b/src/lua.c
index fab1ce3..b853226 100644
--- a/src/lua.c
+++ b/src/lua.c
@@ -243,8 +243,12 @@ static int pmain (lua_State *L) {
   lua_gc(L, LUA_GCRESTART, 0);
   s->status = handle_luainit(L);
   if (s->status != 0) return 0;
-  s->status = handle_image(L, argv, 1);
+  s->status = load_image(L, argv, 1);
   if (s->status != 0) return 0;
+  /* call main() */
+  lua_getglobal(L, "spawn_main");
+  s->status = docall(L, 0, 1);
+  if (s->status != 0) return report_in_developer_mode(L, s->status);
   return 0;
 }