Skip to content

Commit

Permalink
Builtin auth handler: Speed up file writing (#7252)
Browse files Browse the repository at this point in the history
  • Loading branch information
SmallJoker committed Apr 19, 2018
1 parent 9877a1a commit 36eb823
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions builtin/game/auth.lua
Expand Up @@ -42,13 +42,13 @@ local function save_auth_file()
assert(type(stuff.privileges) == "table")
assert(stuff.last_login == nil or type(stuff.last_login) == "number")
end
local content = ""
local content = {}
for name, stuff in pairs(auth_table) do
local priv_string = core.privs_to_string(stuff.privileges)
local parts = {name, stuff.password, priv_string, stuff.last_login or ""}
content = content .. table.concat(parts, ":") .. "\n"
content[#content + 1] = table.concat(parts, ":")
end
if not core.safe_file_write(auth_file_path, content) then
if not core.safe_file_write(auth_file_path, table.concat(content, "\n")) then
error(auth_file_path.." could not be written to")
end
end
Expand Down

0 comments on commit 36eb823

Please sign in to comment.