the bindings wrote the keys on completion, so they existed
and __newindex was never called - now current {storage|size}
are saved as cache.current_{storage|size}
/* Store current configuration */
lua_getglobal(L, "cache");
- lua_pushstring(L, "size");
+ lua_pushstring(L, "current_size");
lua_pushnumber(L, cache_size);
lua_rawset(L, -3);
- lua_pushstring(L, "storage");
+ lua_pushstring(L, "current_storage");
lua_pushstring(L, uri);
lua_rawset(L, -3);
-- `cache.{size|storage} = value`
setmetatable(cache, {
__newindex = function (t,k,v)
- if k == 'size' then t.open(v, rawget(t, 'storage'))
- elseif k == 'storage' then t.open(rawget(t, 'size'), v)
+ if k == 'size' then t.open(v, rawget(t, 'current_storage'))
+ elseif k == 'storage' then t.open(rawget(t, 'current_size'), v)
else rawset(t, k, v) end
end
})