整理代码,准备缓存用户信息相关功能

This commit is contained in:
MrZ626
2021-04-10 16:18:47 +08:00
parent 0b685cc9a2
commit 05808e4587
2 changed files with 6 additions and 8 deletions

View File

@@ -34,7 +34,7 @@ love.keyboard.setTextInput(false)
love.mouse.setVisible(false) love.mouse.setVisible(false)
--Create directories --Create directories
for _,v in next,{"conf","record","replay"}do for _,v in next,{"conf","record","replay","cache"}do
local info=fs.getInfo(v) local info=fs.getInfo(v)
if not info then if not info then
fs.createDirectory(v) fs.createDirectory(v)

View File

@@ -141,15 +141,13 @@ function NET.storeUserInfo(res)
local user=USERS[res.uid] local user=USERS[res.uid]
if not user then if not user then
user={} user={}
user.email=res.email
user.name=res.username
USERS[res.uid]=user USERS[res.uid]=user
else
user.email=res.email
user.name=res.username
if not user.motto then user.motto=res.motto end
if not user.avatar then user.avatar=res.avatar end
end end
user.uid=res.uid
user.email=res.email
user.username=res.username
user.motto=res.motto
user.avatar=res.avatar
--Get own name --Get own name
if res.uid==USER.uid then if res.uid==USER.uid then