summaryrefslogtreecommitdiffhomepage
path: root/libs
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-11-02 22:22:50 +0000
committerSteven Barth <steven@midlink.org>2008-11-02 22:22:50 +0000
commit9d67f6db0136d94aeff9ebc15fc5e4abee42b03a (patch)
treee9fee928eb6ecd8f2b696ac8c889c91e9b90db4c /libs
parent096ff297556af01baa27d558d9fe107fcdfba9d9 (diff)
Fixed new UVL options
Diffstat (limited to 'libs')
-rw-r--r--libs/uvl/luasrc/uvl.lua41
1 files changed, 23 insertions, 18 deletions
diff --git a/libs/uvl/luasrc/uvl.lua b/libs/uvl/luasrc/uvl.lua
index 8275dbbe1..28924a3cc 100644
--- a/libs/uvl/luasrc/uvl.lua
+++ b/libs/uvl/luasrc/uvl.lua
@@ -335,27 +335,32 @@ function UVL._validate_option( self, option, nodeps )
end
end
- if option:scheme('minlength') then
- if #val < option:scheme('minlength') then
- return false, option:error(ERR.OPT_RANGE(option))
+ val = ( type(val) == "table" and val or { val } )
+ for _, v in ipairs(val) do
+ if option:scheme('minlength') then
+ if #v < option:scheme('minlength') then
+ return false, option:error(ERR.OPT_RANGE(option))
+ end
end
- end
-
- if option:scheme('maxlength') then
- if #val > option:scheme('maxlength') then
- return false, option:error(ERR.OPT_RANGE(option))
+
+ if option:scheme('maxlength') then
+ if #v > option:scheme('maxlength') then
+ return false, option:error(ERR.OPT_RANGE(option))
+ end
end
- end
-
- if option:scheme('minimum') then
- if val < option:scheme('minimum') then
- return false, option:error(ERR.OPT_RANGE(option))
+
+ v = tonumber(v)
+
+ if option:scheme('minimum') then
+ if not v or v < option:scheme('minimum') then
+ return false, option:error(ERR.OPT_RANGE(option))
+ end
end
- end
-
- if option:scheme('maximum') then
- if val > option:scheme('maximum') then
- return false, option:error(ERR.OPT_RANGE(option))
+
+ if option:scheme('maximum') then
+ if not v or v > option:scheme('maximum') then
+ return false, option:error(ERR.OPT_RANGE(option))
+ end
end
end