From 15869c6bdbd13672684a38a3441eb9a66518b7ac Mon Sep 17 00:00:00 2001 From: Francois Perrad Date: Mon, 18 Sep 2017 20:37:17 +0200 Subject: fix last luacheck errors valua.lua:52:7: (W213) unused loop variable i valua.lua:86:8: (W431) shadowing upvalue len on line 24 --- .travis.yml | 2 +- valua.lua | 6 +++--- 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 -- cgit v1.2.3-70-g09d2