Skip to content

Commit

Permalink
Home: Fix error on missing write permission
Browse files Browse the repository at this point in the history
  • Loading branch information
SmallJoker committed May 13, 2021
1 parent 6e6383f commit 4d4355a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,14 @@ load_home()
function ui.set_home(player, pos)
local player_name = player:get_player_name()
ui.home_pos[player_name] = vector.round(pos)

-- save the home data from the table to the file
local output = io.open(ui.home_filename, "w")
if not output then
minetest.log("warning", "[unified_inventory] Failed to save file: "
.. ui.home_filename)
return
end
for k, v in pairs(ui.home_pos) do
output:write(v.x.." "..v.y.." "..v.z.." "..k.."\n")
end
Expand Down

0 comments on commit 4d4355a

Please sign in to comment.