diff options
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 |