From dfd02c4577869306c3e9e55685b6aa1bcfb45d69 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Mon, 30 Jul 2012 00:40:02 +0100 Subject: moduleapi: If path name ends with '-cache' create table as weak (keys and values) --- core/moduleapi.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'core') diff --git a/core/moduleapi.lua b/core/moduleapi.lua index 54077826..c98a7e4b 100644 --- a/core/moduleapi.lua +++ b/core/moduleapi.lua @@ -155,6 +155,9 @@ function api:shared(...) local shared = shared_data[path]; if not shared then shared = {}; + if path:match("%-cache$") then + setmetatable(shared, { __mode = "kv" }); + end shared_data[path] = shared; end t_insert(data_array, shared); @@ -336,4 +339,4 @@ function api:load_resource(path, mode) return io.open(path, mode); end -return api; \ No newline at end of file +return api; -- cgit v1.2.3