Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Commit

Permalink
Make settings errors localizable.
Browse files Browse the repository at this point in the history
  • Loading branch information
narc0tiq committed Sep 7, 2015
1 parent 2d541f8 commit b1a68c0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions locale/en/locale.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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__!
10 changes: 5 additions & 5 deletions settingsGUI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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

Expand Down

0 comments on commit b1a68c0

Please sign in to comment.