diff options
author | Hans Hagen <pragma@wxs.nl> | 2016-11-01 11:41:49 +0100 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2016-11-01 11:41:49 +0100 |
commit | 5a501d72ddc9ab9003746aa46fad3a12046e20ec (patch) | |
tree | 961dfe1070db46aa798ec0dc553f19b60f8355c6 /tex/context/base/mkiv/l-table.lua | |
parent | f0bc9c17c5298a3a4645f28a39273f52c27c646a (diff) | |
download | context-5a501d72ddc9ab9003746aa46fad3a12046e20ec.tar.gz |
2016-11-01 10:15:00
Diffstat (limited to 'tex/context/base/mkiv/l-table.lua')
-rw-r--r-- | tex/context/base/mkiv/l-table.lua | 11 |
1 files changed, 9 insertions, 2 deletions
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 |