From b3cdf932126fea9a55c610b053738be278865a75 Mon Sep 17 00:00:00 2001 From: HybridDog Date: Fri, 29 Apr 2016 18:05:04 +0200 Subject: [PATCH] make more tables weak --- src/mapgen_v6.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mapgen_v6.lua b/src/mapgen_v6.lua index d72515c..992409f 100644 --- a/src/mapgen_v6.lua +++ b/src/mapgen_v6.lua @@ -60,7 +60,7 @@ local function get_ws_value(a, x) else ws_values[a] = {} -- weak table, see https://www.lua.org/pil/17.1.html - setmetatable(ws_values[a], {__mode = "v"}) + setmetatable(ws_values[a], {__mode = "kv"}) end v = do_ws_func(a, x) ws_values[a][x] = v @@ -68,6 +68,7 @@ local function get_ws_value(a, x) end local plantlike_ids = {} +setmetatable(plantlike_ids, {__mode = "kv"}) local function is_plantlike(id) if plantlike_ids[id] ~= nil then return plantlike_ids[id] @@ -88,6 +89,7 @@ local function is_plantlike(id) end local snowable_ids = {} +setmetatable(snowable_ids, {__mode = "kv"}) local function is_snowable(id) if snowable_ids[id] ~= nil then return snowable_ids[id]