Change global table "NETWORK" to "ACCOUNT"

This commit is contained in:
Particle_G
2020-11-26 22:00:43 +08:00
committed by MrZ626
parent 9e6e170e49
commit ba7168edd4
3 changed files with 9 additions and 9 deletions

View File

@@ -110,7 +110,7 @@ function FILE.saveSetting()
end end
end end
function FILE.loadNetwork() function FILE.loadAccount()
local F=files.setting local F=files.setting
if F:open("r")then if F:open("r")then
local s=F:read() local s=F:read()
@@ -121,14 +121,14 @@ function FILE.loadNetwork()
F:close() F:close()
if s then if s then
setfenv(s,{}) setfenv(s,{})
addToTable(s(),NETWORK) addToTable(s(),ACCOUNT)
end end
end end
end end
function FILE.saveNetwork() function FILE.saveAccount()
local F=files.setting local F=files.setting
F:open("w") F:open("w")
F:write(dumpTable(NETWORK)) F:write(dumpTable(ACCOUNT))
F:flush()F:close() F:flush()F:close()
end end

View File

@@ -299,7 +299,7 @@ for i=1,25 do
STAT.spin[i]={0,0,0,0,0,0,0} STAT.spin[i]={0,0,0,0,0,0,0}
end end
NETWORK={ ACCOUNT={
id=nil, id=nil,
username=nil, username=nil,
motto=nil, motto=nil,

View File

@@ -156,10 +156,10 @@ function Tick.httpREQ_login(data)
local success,content=json.decode(response.body) local success,content=json.decode(response.body)
if success then if success then
LOG.print(text.loginSuccessed..": "..content.message) LOG.print(text.loginSuccessed..": "..content.message)
NETWORK.id=content.id ACCOUNT.id=content.id
NETWORK.username=content.username ACCOUNT.username=content.username
NETWORK.auth_token=content.auth_token ACCOUNT.auth_token=content.auth_token
FILE.saveNetwork() FILE.saveAccount()
else else
LOG.print(text.jsonError,"warn") LOG.print(text.jsonError,"warn")
end end