Module extensions.base

Extensions to the Lua standard base library.

Functions

printf (message, ...) Format a message and then print it.
errorf (message, level, ...) Format a message and then throw an error.
assertf (cond, message, level, ...) Assert a condition, throws an error with a formatted message if it is false.
enumerate (iterator[, ...]) Returns an array of the first return of an iterator.
enumerateall (iterator[, ...]) Returns an array of arrays of the returns of an iterator


Functions

printf (message, ...) line 18
Format a message and then print it.

Parameters:

  • message any
  • ... any
errorf (message, level, ...) line 26
Format a message and then throw an error.

Parameters:

  • message any
  • level integer?
  • ... any
assertf (cond, message, level, ...) line 35
Assert a condition, throws an error with a formatted message if it is false.

Parameters:

  • cond any
  • message any
  • level integer?
  • ... any
enumerate (iterator[, ...]) line 48
Returns an array of the first return of an iterator.

Parameters:

  • iterator function
  • ... any (optional)

Returns:

    table

Usage:

    enumerate(pairs({5, 7})) -- {1, 2}
enumerateall (iterator[, ...]) line 63
Returns an array of arrays of the returns of an iterator

Parameters:

  • iterator function
  • ... any (optional)

Returns:

    table

Usage:

    enumerateall(pairs({5, 7})) -- {{1, 5}, {2, 7}}