# HG changeset patch # User Matthew Wild # Date 1343605202 -3600 # Node ID 375ab71e4b37af87e5d267a4d3e1e777aed25077 # Parent f1157cce5d7a06530329d3a8062ab271c6c93080 moduleapi: If path name ends with '-cache' create table as weak (keys and values) diff -r f1157cce5d7a -r 375ab71e4b37 core/moduleapi.lua --- a/core/moduleapi.lua Sun Jul 29 22:21:58 2012 +0200 +++ b/core/moduleapi.lua Mon Jul 30 00:40:02 2012 +0100 @@ -155,6 +155,9 @@ 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 @@ return io.open(path, mode); end -return api; \ No newline at end of file +return api;