mirror of
https://github.com/luanti-org/minetest_game.git
synced 2025-06-04 21:10:04 -04:00
speed up saving of homefile
switched to table.concat() and only use output:write() one time for speed
This commit is contained in:
parent
8704afe5b1
commit
0698511eab
1 changed files with 7 additions and 5 deletions
|
@ -54,11 +54,13 @@ minetest.register_chatcommand("sethome", {
|
|||
minetest.chat_send_player(name, "Home set!")
|
||||
changed = true
|
||||
if changed then
|
||||
local output = io.open(homes_file, "w")
|
||||
for i, v in pairs(homepos) do
|
||||
output:write(v.x.." "..v.y.." "..v.z.." "..i.."\n")
|
||||
end
|
||||
io.close(output)
|
||||
local output = io.open(home_file, "w")
|
||||
local data = {}
|
||||
for n, p in pairs(homepos) do
|
||||
table.insert(data,(p.x.." "..p.y.." "..p.z.." "..n.."\n")
|
||||
end
|
||||
output:write(table.concat(data))
|
||||
io.close(output)
|
||||
changed = false
|
||||
end
|
||||
end,
|
||||
|
|
Loading…
Add table
Reference in a new issue