diff options
author | Hans Hagen <pragma@wxs.nl> | 2007-09-28 11:58:00 +0200 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2007-09-28 11:58:00 +0200 |
commit | 19af23ac5cb927d986a64ac1dc52ed2d7bad2450 (patch) | |
tree | 2c44222c2581e462afc58122ee79aadf8169316b /tex/context/base/l-table.lua | |
parent | 104ea1dae3d609aeb395e19658ad6ea7d4c85eea (diff) | |
download | context-19af23ac5cb927d986a64ac1dc52ed2d7bad2450.tar.gz |
stable 2007.09.28 11:58
Diffstat (limited to 'tex/context/base/l-table.lua')
-rw-r--r-- | tex/context/base/l-table.lua | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tex/context/base/l-table.lua b/tex/context/base/l-table.lua index e8f56ca09..14fad31d7 100644 --- a/tex/context/base/l-table.lua +++ b/tex/context/base/l-table.lua @@ -169,6 +169,8 @@ end do + -- one of my first exercises in lua ... + -- 34.055.092 32.403.326 arabtype.tma -- 1.620.614 1.513.863 lmroman10-italic.tma -- 1.325.585 1.233.044 lmroman10-regular.tma @@ -528,6 +530,25 @@ function table.tohash(t) return h end +function table.contains(t, v) + if t then + for i=1, #t do + if t[i] == v then + return true + end + end + end + return false +end + +function table.count(t) + local n, e = 0, next(t) + while e do + n, e = n + 1, next(t,e) + end + return n +end + --~ function table.are_equal(a,b) --~ return table.serialize(a) == table.serialize(b) --~ end |