diff options
author | Marius <mariausol@gmail.com> | 2011-02-20 22:00:14 +0200 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2011-02-20 22:00:14 +0200 |
commit | 3880c6aa8cef3b379b06777c09f9ce3e7e61f493 (patch) | |
tree | bcde92b4216855c15fbd77700423f5cb919c05c9 /tex/context/base/node-res.lua | |
parent | 21179ddb493e5c3355211e090959036cc048366b (diff) | |
download | context-3880c6aa8cef3b379b06777c09f9ce3e7e61f493.tar.gz |
beta 2011.02.20 20:34
Diffstat (limited to 'tex/context/base/node-res.lua')
-rw-r--r-- | tex/context/base/node-res.lua | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tex/context/base/node-res.lua b/tex/context/base/node-res.lua index a56b80d82..6e11742de 100644 --- a/tex/context/base/node-res.lua +++ b/tex/context/base/node-res.lua @@ -300,6 +300,29 @@ function nodes.writable_spec(n) -- not pool return spec end +-- local num = userids["my id"] +-- local str = userids[num] + +local userids = utilities.storage.allocate() pool.userids = userids +local lastid = 0 + +setmetatable(userids, { + __index = function(t,k) + if type(k) == "string" then + local n = lastid + 1 + rawset(userids,n,k) + rawset(userids,k,n) + return n + else + rawset(userids,k,k) + return k + end + end, + __call = function(t,k) + return t[k] + end +} ) + function pool.usernumber(id,num) -- if one argument then num local n = copy_node(user_n) if num then |