Merge pull request #171 from Niklp09/flb_list_del_if_empty
Don't serialize empty tables when saving flb lists
This commit is contained in:
commit
11585b2f86
@ -78,7 +78,11 @@ local function del_pos(pos, player)
|
|||||||
local meta = player:get_meta()
|
local meta = player:get_meta()
|
||||||
local lPos = minetest.deserialize(meta:get_string("techage_forceload_blocks")) or {}
|
local lPos = minetest.deserialize(meta:get_string("techage_forceload_blocks")) or {}
|
||||||
lPos = remove_list_elem(lPos, pos)
|
lPos = remove_list_elem(lPos, pos)
|
||||||
meta:set_string("techage_forceload_blocks", minetest.serialize(lPos))
|
if next(lPos) then
|
||||||
|
meta:set_string("techage_forceload_blocks", minetest.serialize(lPos))
|
||||||
|
else
|
||||||
|
meta:set_string("techage_forceload_blocks", "")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function get_pos_list(player)
|
local function get_pos_list(player)
|
||||||
@ -88,7 +92,11 @@ end
|
|||||||
|
|
||||||
local function set_pos_list(player, lPos)
|
local function set_pos_list(player, lPos)
|
||||||
local meta = player:get_meta()
|
local meta = player:get_meta()
|
||||||
meta:set_string("techage_forceload_blocks", minetest.serialize(lPos))
|
if next(lPos) then
|
||||||
|
meta:set_string("techage_forceload_blocks", minetest.serialize(lPos))
|
||||||
|
else
|
||||||
|
meta:set_string("techage_forceload_blocks", "")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function show_flbs(pos, name, range)
|
local function show_flbs(pos, name, range)
|
||||||
|
Loading…
Reference in New Issue
Block a user