summaryrefslogtreecommitdiff
path: root/scripts/context/stubs/mswin/mtxrun.lua
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/context/stubs/mswin/mtxrun.lua')
-rw-r--r--scripts/context/stubs/mswin/mtxrun.lua19
1 files changed, 18 insertions, 1 deletions
diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua
index 2666500ea..449c341ab 100644
--- a/scripts/context/stubs/mswin/mtxrun.lua
+++ b/scripts/context/stubs/mswin/mtxrun.lua
@@ -177,7 +177,7 @@ local getinfo = debug.getinfo
-- Starting with version 5.2 Lua no longer provide ipairs, which makes
-- sense. As we already used the for loop and # in most places the
-- impact on ConTeXt was not that large; the remaining ipairs already
--- have been replaced. In a similar fashio we also hardly used pairs.
+-- have been replaced. In a similar fashion we also hardly used pairs.
--
-- Just in case, we provide the fallbacks as discussed in Programming
-- in Lua (http://www.lua.org/pil/7.3.html):
@@ -1082,6 +1082,23 @@ function table.loweredkeys(t) -- maybe utf
return l
end
+-- new, might move (maybe duplicate)
+
+function table.unique(old)
+ local hash = { }
+ local new = { }
+ local n = 0
+ for i=1,#old do
+ local oi = old[i]
+ if not hash[oi] then
+ n = n + 1
+ new[n] = oi
+ hash[oi] = true
+ end
+ end
+ return new
+end
+
end -- of closure