Module std._debug

Manage debug mode, and associated substate hints.

Set or change all the debug substate hints by calling the returned module functable with no argument to reset to defaults; with true to set all substate hints into development mode, or false for production mode.

local _debug = require 'std._debug'(false)

Query substate hints by indexing the returned module functable keys:

local isstrict = _debug.strict

Beware that even though you can change std._debug state at any time, stdlib libraries in particular (but probably other clients too) are configured at load time according to the state at the time they are required - e.g. changing _debug.strict after require 'std' does not affect the strict environment already created for the 'std' module when it was previously loaded.

Metamethods

__call ([enable]) Change the all builtin debug hints.
__index (name) Lazy loading of std._debug modules.

Types

Substates Builtin debug substate hints.


Metamethods

__call ([enable])
Change the all builtin debug hints.

Parameters:

  • enable bool or disable all debugging substate hints (optional)

Returns:

    Substates substates

Usage:

    -- Enable all debugging substates
    local _debug = require 'std._debug'(true)
__index (name)
Lazy loading of std._debug modules. Don't load everything on initial startup, wait until first attempt to access a submodule, and then load it on demand.

Parameters:

Returns:

    table or nil

    the submodule that was loaded to satisfy the missing

    `name`, otherwise `nil` if nothing was found
    

Usage:

    local version = require 'std._debug'.version

Types

Substates
Builtin debug substate hints.

Use __call metamethod to set all substate hints at once. Note that none of the debugging features required to implement these hints are encoded here, this module is merely a central location to record systemwide hint; other modules you load subsequently may or may not choose to behave according to their content.

Fields:

  • argcheck bool true if runtime argument checking is desired (default true)
  • deprecate bool nil if deprecated api warnings are desired; false if deprecated apis without warnings are desired; true if removal of deprecated apis is preferred (optional)
  • level int debugging level (default 1)
  • strict bool true if strict enforcement of variable declaration before use is desired (default true)

Usage:

    require 'std._debug'.argcheck = false
generated by LDoc 1.4.6 Last updated 2018-09-22 16:00:27