summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/l-table.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2019-09-09 14:55:35 +0200
committerContext Git Mirror Bot <phg@phi-gamma.net>2019-09-09 14:55:35 +0200
commit438b065a2337ee587442f25ddc587c4762f4d0b0 (patch)
treed18c8f7e51dd7e96b8e774f94d3f8862a6c38f73 /tex/context/base/mkiv/l-table.lua
parentfca2d946bc4d3ef525c3a2c9016e3b88d6d09812 (diff)
downloadcontext-438b065a2337ee587442f25ddc587c4762f4d0b0.tar.gz
2019-09-09 13:52:00
Diffstat (limited to 'tex/context/base/mkiv/l-table.lua')
-rw-r--r--tex/context/base/mkiv/l-table.lua31
1 files changed, 31 insertions, 0 deletions
diff --git a/tex/context/base/mkiv/l-table.lua b/tex/context/base/mkiv/l-table.lua
index cffdcc23e..e82820386 100644
--- a/tex/context/base/mkiv/l-table.lua
+++ b/tex/context/base/mkiv/l-table.lua
@@ -287,6 +287,37 @@ local function sortedhash(t,cmp)
return nothing
end
+-- local function iterate(t,i)
+-- local i = i + 1
+-- if i <= t.n then
+-- local k = t[i]
+-- return i, k, t.t[k]
+-- end
+-- end
+--
+-- local function indexedhash(t,cmp)
+-- if t then
+-- local s
+-- if cmp then
+-- -- it would be nice if the sort function would accept a third argument (or nicer, an optional first)
+-- s = sortedhashkeys(t,function(a,b) return cmp(t,a,b) end)
+-- else
+-- s = sortedkeys(t) -- the robust one
+-- end
+-- local m = #s
+-- if m == 1 then
+-- return next, t
+-- elseif m > 0 then
+-- s.n = m
+-- s.t = t
+-- return iterate, s, 0
+-- end
+-- end
+-- return nothing
+-- end
+--
+-- -- for i, k, v in indexedhash(t) do print(k,v,s) end
+
table.sortedhash = sortedhash
table.sortedpairs = sortedhash -- obsolete