From 0f3bac595e6f4f9b5e95402fc6ebc5f760601a4a Mon Sep 17 00:00:00 2001 From: Eduardo Bart Date: Fri, 6 Jan 2012 22:18:08 -0200 Subject: [PATCH] fix possible lua errors --- modules/client_entergame/entergame.lua | 6 +++--- modules/client_options/options.lua | 9 +++++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/modules/client_entergame/entergame.lua b/modules/client_entergame/entergame.lua index 21addddd..28a5de5c 100644 --- a/modules/client_entergame/entergame.lua +++ b/modules/client_entergame/entergame.lua @@ -56,8 +56,8 @@ function EnterGame.create() local account = Settings.get('account') local password = Settings.get('password') local host = Settings.get('host') - local port = tonumber(Settings.get('port')) - local autologin = toboolean(Settings.get('autologin')) + local port = Settings.getNumber('port') + local autologin = Settings.getBoolean('autologin') enterGame:getChildById('accountNameLineEdit'):setText(account) enterGame:getChildById('accountPasswordLineEdit'):setText(password) @@ -90,7 +90,7 @@ function EnterGame.doLogin() EnterGame.account = enterGame:getChildById('accountNameLineEdit'):getText() EnterGame.password = enterGame:getChildById('accountPasswordLineEdit'):getText() EnterGame.host = enterGame:getChildById('serverHostLineEdit'):getText() - EnterGame.port = enterGame:getChildById('serverPortLineEdit'):getText() + EnterGame.port = tonumber(enterGame:getChildById('serverPortLineEdit'):getText()) EnterGame.hide() Settings.set('host', EnterGame.host) diff --git a/modules/client_options/options.lua b/modules/client_options/options.lua index 1141bc87..f3331ae0 100644 --- a/modules/client_options/options.lua +++ b/modules/client_options/options.lua @@ -24,9 +24,14 @@ function Options.changeOption(key, status) if key == 'vsync' then g_window.setVerticalSync(status) elseif key == 'showfps' then - addEvent(function() rootWidget:recursiveGetChildById('frameCounter'):setVisible(status) end) + addEvent(function() + local frameCounter = rootWidget:recursiveGetChildById('frameCounter') + if frameCounter then frameCounter:setVisible(status) end + end) elseif key == 'fullscreen' then - addEvent(function() g_window.setFullscreen(status) end) + addEvent(function() + g_window.setFullscreen(status) + end) end Settings.set(key, status) Options[key] = status