From 747bd7bfac66a3eef36e89c2f24e40f1672ede11 Mon Sep 17 00:00:00 2001 From: Niklp Date: Sat, 29 Jun 2024 16:07:49 +0200 Subject: [PATCH] Don't serialize empty tables when saving flb lists --- basic_machines/forceload.lua | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/basic_machines/forceload.lua b/basic_machines/forceload.lua index b6837ee..f095f8c 100644 --- a/basic_machines/forceload.lua +++ b/basic_machines/forceload.lua @@ -78,7 +78,11 @@ local function del_pos(pos, player) local meta = player:get_meta() local lPos = minetest.deserialize(meta:get_string("techage_forceload_blocks")) or {} 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 local function get_pos_list(player) @@ -88,7 +92,11 @@ end local function set_pos_list(player, lPos) 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 local function show_flbs(pos, name, range)