overrides.debug module

Functions

Debug.print(message, trace_levels) Shows the given message if debug is enabled.
Debug.get_meta_value(object, key) Returns the value of the key inside the object or 'InvalidLuaObject' if the LuaObject is invalid.
Debug.object_type(object) Returns the Lua data type or the factorio LuaObject type or 'NoHelpLuaObject' if the LuaObject does not have a help function or 'InvalidLuaObject' if the LuaObject is invalid.
Debug.print_position(position, message) Shows the given message if debug is on.
Debug.cheat(callback) Executes the given callback if cheating is enabled.
Debug.is_closure(func) Returns true if the function is a closure, false otherwise.

Functions

# Debug.print(message, trace_levels)

Shows the given message if debug is enabled.

Uses serpent to print non scalars.

Parameters:
  • message :
  • trace_levels : levels of stack trace to give, defaults to 1 level if nil
# Debug.get_meta_value(object, key)

Returns the value of the key inside the object or 'InvalidLuaObject' if the LuaObject is invalid.

or 'InvalidLuaObjectKey' if the LuaObject does not have an entry at that key

Parameters:
  • object : LuaObject or metatable
  • key :
  • Returns:
    # Debug.object_type(object)

    Returns the Lua data type or the factorio LuaObject type or 'NoHelpLuaObject' if the LuaObject does not have a help function or 'InvalidLuaObject' if the LuaObject is invalid.

    Parameters:
    • object :
    Returns:
    • string
    # Debug.print_position(position, message)

    Shows the given message if debug is on.

    Parameters:
    • position : Position
    • message : string
    # Debug.cheat(callback)

    Executes the given callback if cheating is enabled.

    Parameters:
    • callback : function
    # Debug.is_closure(func)

    Returns true if the function is a closure, false otherwise.

    A closure is a function that contains 'upvalues' or in other words has a reference to a local variable defined outside the function's scope.

    Parameters:
    • func :
    Returns:
    • boolean