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