Releases: tarantool/checks
Releases · tarantool/checks
3.3.0
3.2.0
Added
- "error" type supported.
- "datetime" type supported.
- "interval" type supported.
Fixed
- Fixed compatibility with LuaJIT.
- Fixed compatibility with LuaJIT if strict mode is on.
Version 1.1.0 (Checking the number of function arguments)
Now the library can determine that the number of arguments does not match.
Example:
exam.lua
local checks = require('checks')
local function f1(x, y)
checks('number')
end
local function f2(x)
checks('number', 'number')
end
local function f3(x)
checks('number')
end
f1(1) -- exam.lua:4: too many arguments to function f1
--f2(1) -- exam.lua:8: too few arguments to function f2
--f3('1') -- exam.lua:12: bad argument #1 to f3 (number expected, got string)
f3(1, 2) -- ok :(
f3(1) -- ok
--f1(1, 2)
f2(1, 2)
Limitations
From the begining of function to the checks
you must not declare a local variable.
function foo(x)
local y = 5 -- WRONG!!!
checks('number')
end