m_script = new MainMenuScripting(this);
try {
- if (m_data->errormessage != "") {
- m_script->setMainMenuErrorMessage(m_data->errormessage);
- m_data->errormessage = "";
- }
+ m_script->setMainMenuData(&m_data->script_data);
+ m_data->script_data.errormessage = "";
if (!loadMainMenuScript()) {
errorstream << "No future without mainmenu" << std::endl;
}
run();
- }
- catch(LuaError &e) {
+ } catch (LuaError &e) {
errorstream << "MAINMENU ERROR: " << e.what() << std::endl;
- m_data->errormessage = e.what();
+ m_data->script_data.errormessage = e.what();
}
m_menu->quitMenu();
}
std::string script = porting::path_share + DIR_DELIM "builtin" + DIR_DELIM "init.lua";
- if (m_script->loadScript(script)) {
+ try {
+ m_script->loadScript(script);
// Menu script loaded
return true;
- } else {
- infostream
- << "GUIEngine: execution of menu script in: \""
- << m_scriptdir << "\" failed!" << std::endl;
+ } catch (const ModError &e) {
+ errorstream << "GUIEngine: execution of menu script failed: "
+ << e.what() << std::endl;
}
return false;