From 438b065a2337ee587442f25ddc587c4762f4d0b0 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Mon, 9 Sep 2019 14:55:35 +0200 Subject: 2019-09-09 13:52:00 --- tex/context/base/mkiv/l-table.lua | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'tex/context/base/mkiv/l-table.lua') 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 -- cgit v1.2.3