diff options
author | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2014-06-25 22:35:21 +0300 |
---|---|---|
committer | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2014-06-25 23:35:46 +0300 |
commit | 8707c1eccd1f27454ee46ebef5613579c4c3c736 (patch) | |
tree | 80d0b770ab3b09e2208524d8ea6e10f912919252 /aconf | |
parent | 9b1a1d67f288ef3ba01d2c6c5724d844eb67ca02 (diff) | |
download | aconf-8707c1eccd1f27454ee46ebef5613579c4c3c736.tar.bz2 aconf-8707c1eccd1f27454ee46ebef5613579c4c3c736.tar.xz |
web client: editable sets of primitive types
Diffstat (limited to 'aconf')
-rw-r--r-- | aconf/model/set.lua | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/aconf/model/set.lua b/aconf/model/set.lua index ac8904b..8b51f12 100644 --- a/aconf/model/set.lua +++ b/aconf/model/set.lua @@ -9,7 +9,7 @@ local TreeNode = require('aconf.model.field').TreeNode local node = require('aconf.model.node') local object = require('aconf.object') local pth = require('aconf.path') -local setdefaults = require('aconf.util').setdefaults +local util = require('aconf.util') M.Set = object.class(require('aconf.model.node').List) @@ -35,7 +35,7 @@ function M.Set:init(context, params) local mt = getmetatable(self) function mt.get(k, options) - options = setdefaults(options or {}, {dereference=true}) + options = util.setdefaults(options or {}, {dereference=true}) local i, v = find(k) if i then return mt.load(i, options) end if options.create then return v end @@ -52,6 +52,13 @@ function M.Set:init(context, params) local insert = mt.insert function mt.insert(v) if not mt.contains(v) then insert(v) end end + + local meta = mt.meta + function mt.meta() + local res = meta() + res.removable = util.map(mt.load, res.removable) + return res + end end |