diff options
Diffstat (limited to 'util.lua')
-rw-r--r-- | util.lua | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/util.lua b/util.lua index 938848c..b5a57b1 100644 --- a/util.lua +++ b/util.lua | |||
@@ -1,11 +1,17 @@ | |||
1 | --- lam.util | 1 | --- lam.util |
2 | 2 | ||
3 | local util = {} | 3 | local m = {} |
4 | local unpack = table.unpack or unpack | ||
5 | 4 | ||
6 | function util.pop (tbl) | 5 | function m.pop (tbl) |
6 | --[[ Remove the first element from TBL. ]] | ||
7 | return table.remove(tbl, 1) | 7 | return table.remove(tbl, 1) |
8 | end | 8 | end |
9 | 9 | ||
10 | function m.arity (r, min, max) | ||
11 | --[[ Return whether R is within MIN and MAX (inclusive). ]] | ||
12 | local len = #r | ||
13 | return len >= min and len <= max | ||
14 | end | ||
15 | |||
10 | --- | 16 | --- |
11 | return util | 17 | return m |