diff --git a/locale/en/locale.cfg b/locale/en/locale.cfg index 00e2c17..72d47a4 100644 --- a/locale/en/locale.cfg +++ b/locale/en/locale.cfg @@ -35,6 +35,10 @@ settings_close=Close err_generic=[EvoGUI|__1__] Error: __2__ err_specific=[EvoGUI|__1__|__2__] Error: __3__ +err_settings_badcall=__1__ called on the wrong thing! +err_settings_whatsensor=__1__ can't find sensor! +err_settings_whatsettings=__1__ called for settings-less sensor! + err_needplayername=[EvoGUI] Need a player name! err_nosuchplayer=[EvoGUI] No such player: __1__! err_noplayerdata=[EvoGUI] No player data for __1__! diff --git a/settingsGUI.lua b/settingsGUI.lua index 2c654d9..ad2b418 100644 --- a/settingsGUI.lua +++ b/settingsGUI.lua @@ -10,7 +10,7 @@ local function toggle_always_visible(event) local player = game.get_player(event.player_index) if event.element.name:sub(1,3) ~= "AV_" then - error(string.format("toggle_always_visible called on the wrong thing: %s", event.element.name)) + error({"err_settings_badcall", "toggle_always_visible"}) return end @@ -28,7 +28,7 @@ local function toggle_in_popup(event) local player = game.get_player(event.player_index) if event.element.name:sub(1,3) ~= "IP_" then - error(string.format("toggle_in_popup called on the wrong thing: %s", event.element.name)) + error({"err_settings_badcall", "toggle_in_popup"}) return end @@ -51,19 +51,19 @@ local function trigger_settings_gui(event) local player = game.get_player(event.player_index) if event.element.name:sub(1,11) ~= "EvoGUI_SET_" then - error(string.format("trigger_settings_gui called on the wrong thing: %s", event.element.name)) + error({"err_settings_badcall", "trigger_settings_gui"}) return end local sensor_name = event.element.name:sub(12,-1) local sensor = ValueSensor.get_by_name(sensor_name) if sensor == nil then - error(string.format("trigger_settings_gui unable to find sensor: %s", event.element.name)) + error({"err_settings_whatsensor", "trigger_settings_gui"}) return end if sensor.settings_gui == nil then - error(string.format("trigger_settings_gui can't trigger settings-less sensor settings: %s", event.element.name)) + error({"err_settings_whatsettings", "trigger_settings_gui"}) return end