@@ -617,7 +617,8 @@ void LuaFile::load()
617
617
lua.set (" COLOR_LIGHT_GREY" , COLOR_LIGHT_GREY);
618
618
619
619
lua.set_function (" launch" , sol::overload ([&](std::string name, std::vector<std::string> arg)
620
- {
620
+ {
621
+ std::cerr << " launch is deprecated, use system.app:launch instead" << std::endl;
621
622
try {
622
623
AppManager::get (name)->run (arg);
623
624
}
@@ -728,6 +729,53 @@ void LuaFile::load()
728
729
729
730
app.set_function (" quit" , [&]()
730
731
{ m_commandQueue.push (QUIT); });
732
+
733
+ app.set_function (" launch" , sol::overload ([&](std::string name, std::vector<std::string> arg)
734
+ {
735
+ try {
736
+ AppManager::get (name)->run (arg);
737
+ }
738
+ catch (std::runtime_error &e) {
739
+ std::cerr << " Erreur: " << e.what () << std::endl;
740
+ // Ajout message d'erreur
741
+ GuiManager &guiManager = GuiManager::getInstance ();
742
+ guiManager.showErrorMessage (e.what ());
743
+ }
744
+
745
+ return true ; },
746
+ [&](std::string name)
747
+ {
748
+ try
749
+ {
750
+ AppManager::get (name)->run ({});
751
+ }
752
+ catch (std::runtime_error &e)
753
+ {
754
+ std::cerr << " Erreur: " << e.what () << std::endl;
755
+ // Ajout message d'erreur
756
+ GuiManager &guiManager = GuiManager::getInstance ();
757
+ guiManager.showErrorMessage (e.what ());
758
+ }
759
+
760
+ return true ;
761
+ }));
762
+
763
+ app.set_function (" stopApp" , sol::overload ([&](std::string name)
764
+ {
765
+ try {
766
+ auto app = AppManager::get (name);
767
+ if (app->luaInstance != nullptr && app->luaInstance .get () != this )
768
+ app->kill ();
769
+ }
770
+ catch (std::runtime_error &e) {
771
+ std::cerr << " Erreur: " << e.what () << std::endl;
772
+ // Ajout message d'erreur
773
+ GuiManager &guiManager = GuiManager::getInstance ();
774
+ guiManager.showErrorMessage (e.what ());
775
+ }
776
+
777
+ return true ; }
778
+ ));
731
779
}
732
780
733
781
/* *
@@ -855,7 +903,7 @@ void LuaFile::wakeup(std::vector<std::string> arg)
855
903
void LuaFile::stop (std::vector<std::string> arg)
856
904
{
857
905
const sol::protected_function func = lua.get <sol::protected_function>(" quit" );
858
- ;
906
+
859
907
if (!func.valid ())
860
908
return ;
861
909
@@ -871,7 +919,7 @@ void LuaFile::loop()
871
919
{
872
920
case QUIT:
873
921
// Quit lua app OUTSIDE of lua
874
- AppManager::quitApp ();
922
+ AppManager::get ( this )-> kill ();
875
923
break ;
876
924
}
877
925
0 commit comments