diff options
author | SmallJoker <SmallJoker@users.noreply.github.com> | 2018-04-19 18:36:10 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-19 18:36:10 +0200 |
commit | 36eb823b1cebc92cd7802368ab0bdc5b3679a3cd (patch) | |
tree | ecefb4656a1ee2a82988d6a1c8966b6caf9bfc7c /builtin | |
parent | 9877a1a207efd48b569cebe5c80e727477fb590f (diff) | |
download | minetest-36eb823b1cebc92cd7802368ab0bdc5b3679a3cd.tar.gz minetest-36eb823b1cebc92cd7802368ab0bdc5b3679a3cd.tar.bz2 minetest-36eb823b1cebc92cd7802368ab0bdc5b3679a3cd.zip |
Builtin auth handler: Speed up file writing (#7252)
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/game/auth.lua | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/builtin/game/auth.lua b/builtin/game/auth.lua index 3d4d6b199..ad2f35a13 100644 --- a/builtin/game/auth.lua +++ b/builtin/game/auth.lua @@ -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 |