fixes in Settings
This commit is contained in:
parent
0f3bac595e
commit
3c62ce97db
|
@ -56,7 +56,7 @@ function EnterGame.create()
|
|||
local account = Settings.get('account')
|
||||
local password = Settings.get('password')
|
||||
local host = Settings.get('host')
|
||||
local port = Settings.getNumber('port')
|
||||
local port = Settings.get('port')
|
||||
local autologin = Settings.getBoolean('autologin')
|
||||
|
||||
enterGame:getChildById('accountNameLineEdit'):setText(account)
|
||||
|
|
|
@ -11,6 +11,8 @@ local function convertSettingValue(value)
|
|||
elseif value.r then
|
||||
return colortostring(value)
|
||||
end
|
||||
elseif value == nil then
|
||||
return ''
|
||||
else
|
||||
return tostring(value)
|
||||
end
|
||||
|
@ -25,7 +27,12 @@ function Settings.remove(key)
|
|||
end
|
||||
|
||||
function Settings.set(key, value)
|
||||
g_configs.set(key, convertSettingValue(value))
|
||||
local valuestr = convertSettingValue(value)
|
||||
if valuestr == '' then
|
||||
g_configs.remove(key)
|
||||
else
|
||||
g_configs.set(key, convertSettingValue(value))
|
||||
end
|
||||
end
|
||||
|
||||
function Settings.setDefault(key, value)
|
||||
|
@ -35,8 +42,7 @@ function Settings.setDefault(key, value)
|
|||
end
|
||||
|
||||
function Settings.get(key, default)
|
||||
if Settings.exists(key) then
|
||||
elseif default ~= nil then
|
||||
if not Settings.exists(key) and default ~= nil then
|
||||
Settings.set(key, default)
|
||||
end
|
||||
return g_configs.get(key)
|
||||
|
|
|
@ -934,6 +934,7 @@ void LuaInterface::pushBoolean(bool v)
|
|||
|
||||
void LuaInterface::pushCString(const char* v)
|
||||
{
|
||||
assert(v);
|
||||
lua_pushstring(L, v);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue