utils.debug module

Functions

Debug.cheat (callback) Executes the given callback if cheating 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.is_closure (func) Returns true if the function is a closure, false otherwise.
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 (message, stack_traceback) Shows the given message if debug is enabled.
Debug.print_position (position, message) Shows the given message if debug is on.

Functions

# Debug.cheat (callback)

Executes the given callback if cheating is enabled.

Parameters:
  • callback : function
# 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.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
    # 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 (message, stack_traceback)

    Shows the given message if debug is enabled.

    Uses serpent to print non scalars.

    Parameters:
    • message :
    • stack_traceback : levels of stack trace to give, defaults to 1 level if nil
    # Debug.print_position (position, message)

    Shows the given message if debug is on.

    Parameters:
    • position : Position
    • message : string