aboutsummaryrefslogtreecommitdiff
path: root/builtin/game
diff options
context:
space:
mode:
authorSmallJoker <SmallJoker@users.noreply.github.com>2018-04-19 18:36:10 +0200
committerSmallJoker <mk939@ymail.com>2018-06-03 17:32:00 +0200
commit14d20f58275e15fa9e81a82f3db475b0d5c22a2d (patch)
treea39671537ddd2b682fbf1e51523bd242eb16f15d /builtin/game
parent0414322d23f1a4393e909dd075771691603838f3 (diff)
downloadminetest-14d20f58275e15fa9e81a82f3db475b0d5c22a2d.tar.gz
minetest-14d20f58275e15fa9e81a82f3db475b0d5c22a2d.tar.bz2
minetest-14d20f58275e15fa9e81a82f3db475b0d5c22a2d.zip
Builtin auth handler: Speed up file writing (#7252)
Diffstat (limited to 'builtin/game')
-rw-r--r--builtin/game/auth.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/builtin/game/auth.lua b/builtin/game/auth.lua
index 74eb6ae88..19af8db73 100644
--- a/builtin/game/auth.lua
+++ b/builtin/game/auth.lua
@@ -67,13 +67,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(core.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(core.auth_file_path, content) then
+ if not core.safe_file_write(core.auth_file_path, table.concat(content, "\n")) then
error(core.auth_file_path.." could not be written to")
end
end