From 5a501d72ddc9ab9003746aa46fad3a12046e20ec Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Tue, 1 Nov 2016 11:41:49 +0100 Subject: 2016-11-01 10:15:00 --- tex/context/base/mkiv/l-table.lua | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (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 498f51833..1cf63db0c 100644 --- a/tex/context/base/mkiv/l-table.lua +++ b/tex/context/base/mkiv/l-table.lua @@ -1077,7 +1077,7 @@ function table.count(t) return n end -function table.swapped(t,s) -- hash +function table.swapped(t,s) -- hash, we need to make sure we don't mess up next local n = { } if s then for k, v in next, s do @@ -1090,7 +1090,14 @@ function table.swapped(t,s) -- hash return n end -function table.mirrored(t) -- hash +function table.hashed(t) -- list, add hash to index (save because we are not yet mixed + for i=1,#t do + t[t[i]] = i + end + return t +end + +function table.mirrored(t) -- hash, we need to make sure we don't mess up next local n = { } for k, v in next, t do n[v] = k -- cgit v1.2.3