aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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