Tarantool Lua API

strict

The strict module has functions for turning "strict mode" on or off. When strict mode is on, an attempt to use an undeclared global variable will cause an error. A global variable is considered "undeclared" if it has never had a value assigned to it. Often this is an indication of a programming error.

By default strict mode is off, unless tarantool was built with the -DCMAKE_BUILD_TYPE=Debug option.

Example:

    tarantool> strict = require('strict')
    ---
    ...
    tarantool> strict.on()
    ---
    ...
    tarantool> a = b -- strict mode is on so this will cause an error
    ---
    - error: ... variable 'b' is not declared
    ...
    tarantool> strict.off()
    ---
    ...
    tarantool> a = b -- strict mode is off so this will not cause an error
    ---
    ...

Methods2

function M.off() -> nil

Disable strict mode.

When strict mode is off, an attempt to use an undeclared global variable will not cause an error.

Example:

 strict = require('strict')
 strict.off()
function M.on() -> nil

Enable strict mode.

When strict mode is on, an attempt to use an undeclared global variable will cause an error.

Example:

 strict = require('strict')
 strict.on()