mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2025-01-23 16:30:19 +01:00
[rune] Check if inventory data was retrieved before saving
This commit is contained in:
parent
1ae6169227
commit
22b863cf41
@ -278,6 +278,10 @@ runes.functions.save_detached_inventory = function(player)
|
||||
local player_inv = player:get_inventory()
|
||||
local datafile = io.open(minetest.get_worldpath().."/runes/"..name.."_rune.inv", "w")
|
||||
local rune_inv_data = minetest.get_inventory({type = "detached", name=name.."_runes"})
|
||||
if not rune_inv_data then
|
||||
minetest.log("error", "[runes] Couldn't save rune inventory for player " .. name .. " : data unavailable")
|
||||
return false
|
||||
end
|
||||
local translated_rune_data = {}
|
||||
for index, data in pairs(rune_inv_data:get_list("runes")) do
|
||||
translated_rune_data[index] = data:get_name() .. " " .. data:get_count()
|
||||
|
Loading…
Reference in New Issue
Block a user