std._debug 1.1.0 Reference

# 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 boolean 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:

  - name string submodule name

  ### 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 boolean `true` if runtime argument checking is desired (default true)
  - deprecate boolean `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 integer debugging level (default 1)
  - strict boolean `true` if strict enforcement of variable declaration before use is desired (default true)

  ### Usage:

      require 'std._debug'.argcheck = false

generated by LDoc 1.5.0 Last updated 2026-07-25 16:34:09