moduleapi: If path name ends with '-cache' create table as weak (keys and values)

vault/0.11
Matthew Wild 14 years ago
parent dbfa0c8ce7
commit a515ffa5e3
  1. 5
      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;
return api;

Loading…
Cancel
Save