diff options
-rw-r--r-- | lua-interface-light.lua | 22 | ||||
-rw-r--r-- | src/lua-interface.cpp | 10 |
2 files changed, 24 insertions, 8 deletions
diff --git a/lua-interface-light.lua b/lua-interface-light.lua index ae115f9..b34baf9 100644 --- a/lua-interface-light.lua +++ b/lua-interface-light.lua @@ -142,23 +142,31 @@ local function generate_dlg() } end -function lua_interface_light_main() - local dlg = generate_dlg() +function lua_interface_light_main(passthru) + if not passthru then + local dlg = generate_dlg() - dlg:show() - iup.MainLoop() - dlg:hide() + dlg:show() + iup.MainLoop() + dlg:hide() + else + okay = true + end if commandline then return true end if not okay then return false end - if not pcall(Archive, input_file_text.value) then - error(error_not_archive_locale[system_locale]) + if not passthru then + if not pcall(Archive, input_file_text.value) then + error(error_not_archive_locale[system_locale]) + end end if not pcall(load, "archive_main.lua") then + if passthru then return lua_interface_light_main(false) end error(error_wrong_archive_locale[system_locale]) end if not type(archive_main) == "function" then + if passthru then return lua_interface_light_main(false) end error(error_bad_lua_locale[system_locale]) end diff --git a/src/lua-interface.cpp b/src/lua-interface.cpp index c26df03..d05b95a 100644 --- a/src/lua-interface.cpp +++ b/src/lua-interface.cpp @@ -998,10 +998,18 @@ virtual int startup() throw (GeneralException) { built.write(lua_interface_light_lua, size_lua_interface_light_lua); try { + bool passthru = true; + try { + new Archive(argv[0], ARCHIVE_EXECUTABLE); + } + catch (...) { + passthru = false; + } L->load(&built); L->push("lua_interface_light_main"); L->gettable(LUA_GLOBALSINDEX); - L->call(0, 1); + L->push(passthru); + L->call(1, 1); interactive = L->toboolean(); L->pop(); if (interactive) { |