Skip to content

Commit

Permalink
Beds: Quicker saves with tidy output
Browse files Browse the repository at this point in the history
Tweaked the beds.save_spawns() function to compile list then output
to file with shortened co-ordinates containing 1 decimal place
  • Loading branch information
tenplus1 authored and paramat committed Apr 29, 2016
1 parent 5cd4b5a commit dc7cbdd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions mods/beds/spawns.lua
Expand Up @@ -41,10 +41,12 @@ function beds.save_spawns()
if not beds.spawn then
return
end
local data = {}
local output = io.open(org_file, "w")
for i, v in pairs(beds.spawn) do
output:write(v.x .. " " .. v.y .. " " .. v.z .. " " .. i .. "\n")
for k, v in pairs(beds.spawn) do
table.insert(data, string.format("%.1f %.1f %.1f %s\n", v.x, v.y, v.z, k))
end
output:write(table.concat(data))
io.close(output)
end

Expand Down

0 comments on commit dc7cbdd

Please sign in to comment.