Skip to content

Releases: tarantool/checks

3.3.0

20 Apr 07:41
Compare
Choose a tag to compare

Overview

This release introduces API to check module version in code and built-in module overriding.

Breaking changes

This release should not break any existing behavior.

New features

  • Versioning supported.
  • Override built-in checks, if installed.

Changes

  • Build rock with cmake.

3.2.0

27 Jan 16:13
9c9c18c
Compare
Choose a tag to compare

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)

30 May 10:26
Compare
Choose a tag to compare

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