diff options
author | Daniel Silverstone <dsilvers@digital-scurf.org> | 2013-11-15 16:53:09 +0000 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2013-11-15 16:53:09 +0000 |
commit | 5e75621b1c9a389016bb9bf6daa2b2c0a1386e83 (patch) | |
tree | f26b13ee64917763ec74da3893f4489e5096c81b /lib | |
parent | 4cb991a303e8826da72244e0ccfb40fea376260d (diff) | |
download | gitano-5e75621b1c9a389016bb9bf6daa2b2c0a1386e83.tar.gz |
Fix up tabular matches to be less insane
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitano/lace.lua | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/lib/gitano/lace.lua b/lib/gitano/lace.lua index 97ed91b..25183ed 100644 --- a/lib/gitano/lace.lua +++ b/lib/gitano/lace.lua @@ -86,19 +86,14 @@ local function _do_simple_match(ctx, key, matchtype, value) if type(kk) == "string" then return check(value, kk) else - if pat and kk[1] ~= nil then - for i = 1, #kk do - if check(value, kk[i]) then - return true - end - end - return false - else - if matchtype:sub(1,1) == "!" then - return kk[value] == nil - end - return kk[value] ~= nil + local ret = false + for k in pairs(kk) do + ret = ret or check(value, k) + end + if matchtype:sub(1,1) == "!" then + ret = not ret end + return ret end end |