aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancois Perrad <francois.perrad@gadz.org>2017-09-18 20:37:17 +0200
committerFrancois Perrad <francois.perrad@gadz.org>2017-09-20 20:42:08 +0200
commit15869c6bdbd13672684a38a3441eb9a66518b7ac (patch)
tree9d455b4f873aa213185e9a8a01f26bd4618155b0
parent56809323fa51316b61c33f08cf0a17b601c849cb (diff)
downloadvalua-15869c6bdbd13672684a38a3441eb9a66518b7ac.tar.gz
valua-15869c6bdbd13672684a38a3441eb9a66518b7ac.tar.bz2
valua-15869c6bdbd13672684a38a3441eb9a66518b7ac.zip
fix last luacheck errors
valua.lua:52:7: (W213) unused loop variable i valua.lua:86:8: (W431) shadowing upvalue len on line 24
-rw-r--r--.travis.yml2
-rw-r--r--valua.lua6
2 files changed, 4 insertions, 4 deletions
diff --git a/.travis.yml b/.travis.yml
index ffdef71..5628fd1 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -22,7 +22,7 @@ install:
- luarocks install luacheck
script:
- # - luacheck --codes --std=max *.lua
+ - luacheck --codes --std=max *.lua
- lua valua-test.lua
after_success:
diff --git a/valua.lua b/valua.lua
index c60dc3d..4de673b 100644
--- a/valua.lua
+++ b/valua.lua
@@ -49,7 +49,7 @@ function valua:new(obj)
local res = true
local fres, err
-- iterates through all chained validations funcs that were packed, passing the value to be validated
- for i,f in ipairs(t.funcs) do
+ for _,f in ipairs(t.funcs) do
fres,err = f(value)
res = res and fres
-- breaks the chain if a test fails
@@ -83,8 +83,8 @@ end
-- String
function valua._len(value,min,max)
- local len = len(value or '')
- if len < min or len >max then return false,"should have "..min.."-"..max.." characters" end
+ local l = len(value or '')
+ if l < min or l > max then return false,"should have "..min.."-"..max.." characters" end
return true
end