diff --git a/init.lua b/init.lua index bc23819..d891174 100644 --- a/init.lua +++ b/init.lua @@ -13,7 +13,7 @@ default_privs = minetest.settings:get("switch_creative.default_privs") or "-crea function switch_creative:load_areas() self.astore:from_file(minetest.get_worldpath().."/switch_creative_areas") --- local test = minetest.deserialize(mod_storage:get_string("astore")) + switch_creative.area_privs = minetest.deserialize(mod_storage:get_string("astore_privs")) or {} -- local edge1 = { x=-10, y=-10, z=-10 } -- local edge2 = { x=10, y=10, z=10 } -- local data = "Testarea" @@ -24,13 +24,12 @@ end function switch_creative:save_areas() self.astore:to_file(minetest.get_worldpath().."/switch_creative_areas") --- local datastr = minetest.serialize(self.astore) --- if not datastr then --- minetest.log("error", "[switch_creative] Failed to serialize area data!") --- return --- end --- mod_storage:set_string("astore", datastr) - + local datastr = minetest.serialize(switch_creative.area_privs) + if not datastr then + minetest.log("error", "[switch_creative] Failed to serialize area_privs data!") + return + end + mod_storage:set_string("astore", datastr) end function switch_creative:set_area_privs(id, privs_string)