mirror of
https://github.com/luanti-org/minetest_game.git
synced 2025-06-06 05:44:26 -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!")
|
minetest.chat_send_player(name, "Home set!")
|
||||||
changed = true
|
changed = true
|
||||||
if changed then
|
if changed then
|
||||||
local output = io.open(homes_file, "w")
|
local output = io.open(home_file, "w")
|
||||||
for i, v in pairs(homepos) do
|
local data = {}
|
||||||
output:write(v.x.." "..v.y.." "..v.z.." "..i.."\n")
|
for n, p in pairs(homepos) do
|
||||||
end
|
table.insert(data,(p.x.." "..p.y.." "..p.z.." "..n.."\n")
|
||||||
io.close(output)
|
end
|
||||||
|
output:write(table.concat(data))
|
||||||
|
io.close(output)
|
||||||
changed = false
|
changed = false
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
Loading…
Add table
Reference in a new issue