diff options
author | Context Git Mirror Bot <phg42.2a@gmail.com> | 2016-09-23 11:04:57 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2016-09-23 11:04:57 +0200 |
commit | 9858ddd23d54c56b2ce9e1f5580190d3210d18ed (patch) | |
tree | a73afdfc043fae5b69367c89ec2d7f3fa56a870f /tex/context/base/mkiv/strc-num.lua | |
parent | e713d5aa882024dc438506c2f75eae6c5021a237 (diff) | |
download | context-9858ddd23d54c56b2ce9e1f5580190d3210d18ed.tar.gz |
2016-09-23 10:19:00
Diffstat (limited to 'tex/context/base/mkiv/strc-num.lua')
-rw-r--r-- | tex/context/base/mkiv/strc-num.lua | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/tex/context/base/mkiv/strc-num.lua b/tex/context/base/mkiv/strc-num.lua index d2181342a..98db1b42d 100644 --- a/tex/context/base/mkiv/strc-num.lua +++ b/tex/context/base/mkiv/strc-num.lua @@ -165,7 +165,7 @@ local function enhance() enhance = nil end -local function allocate(name,i) -- can be metatable +local function allocate(name,i) -- can be metatable but it's a bit messy local cd = counterdata[name] if not cd then cd = { @@ -182,20 +182,24 @@ local function allocate(name,i) -- can be metatable cd = cd.data local ci = cd[i] if not ci then - ci = { - number = 0, - start = 0, - saved = 0, - step = 1, - range = 1, - offset = false, - stop = 0, -- via metatable: last, first, stop only for tracing - } - setmetatableindex(ci, function(t,s) return constructor[s](t,name,i) end) - cd[i] = ci - tobesaved[name][i] = { } - else - if enhance then enhance() end -- not stored in bytecode + for i=1,i do + if not cd[i] then + ci = { + number = 0, + start = 0, + saved = 0, + step = 1, + range = 1, + offset = false, + stop = 0, -- via metatable: last, first, stop only for tracing + } + setmetatableindex(ci, function(t,s) return constructor[s](t,name,i) end) + cd[i] = ci + tobesaved[name][i] = { } + end + end + elseif enhance then + enhance() -- not stored in bytecode end return ci end |