Module FSM

Factorio Softmod Manager

Usage:

    Manager = require("FactorioSoftmodManager")
     Used to load all other modules that are indexed in index.lua
    

Info:

  • Author: Cooldude2606

Functions

_verbose (rtn) Default output for the verbose
verbose (rtn, action) Used to call the output of the verbose when the current state allows it

Fields

setVerbose Main logic for allowing verbose at different stages though out the script
sandbox Creates a sand box envorment and runs a callback in that sand box; provents global pollution
loadModules Loads the modules that are present in the index list
error A more detailed replacement for the lua error function to allow for handlers to be added; repleaces default error so error can be used instead of Manager.error
names Sub set to Manger.event and acts as a coverter between event_name and event_id


Functions

_verbose (rtn)
Default output for the verbose

Parameters:

  • rtn string the value that will be returned though verbose output

Usage:

    Manager.verbose('Hello, World!')
verbose (rtn, action)
Used to call the output of the verbose when the current state allows it

Parameters:

  • rtn string the value that will be returned though verbose output
  • action string is used to decide which verbose this is error || event etc

Usage:

    Manager.verbose('Hello, World!')

Fields

setVerbose
Main logic for allowing verbose at different stages though out the script
  • table newTbl the table that will be searched for settings to be updated

Usage:

  • Manager.setVerbose{output=log}
  • Manager.setVerbose[setting] -- returns the value of that setting
  • tostring(Manager.setVerbose) -- returns a formated list of the current settings
sandbox
Creates a sand box envorment and runs a callback in that sand box; provents global pollution
  • function callback the function that will be ran in the sandbox
  • any other params that the function will use (optional)

Usage:

  • Manager.sandbox(callback) -- return sandbox, success, other returns from callback
  • Manager.sandbox() -- returns and empty sandbox
  • Manager.sandbox[key] -- returns the sand box value in that key
loadModules
Loads the modules that are present in the index list

Usage:

  • Manager.loadModules() -- loads all moddules in the index list
  • #Manager.loadModules -- returns the number of modules loaded
  • tostring(Manager.loadModules) -- returns a formatted list of all modules loaded
  • pairs(Manager.loadModules) -- loops over the loaded modules moduleName, module
error
A more detailed replacement for the lua error function to allow for handlers to be added; repleaces default error so error can be used instead of Manager.error
  • string name || fucntion the name that is given to the callback || the callback that will be used
  • string name || fucntion the name that is given to the callback || the callback that will be used
  • function callback if name is given as a string this will be the callback used

Usage:

  • Manager.error(err) -- calls all error handlers that are set or if none then prints to game and if that fails crashs game
  • Manager.error() -- returns an error constant that can be used to crash game
  • Manager.error(Manager.error()) -- crashs the game
  • Manager.error.addHandler(name,callback) -- adds a new handler if handler returns Manager.error() then game will crash
  • Manager.error[name] -- returns the handler of that name if present
  • #Manager.error -- returns the number of error handlers that are present
  • pairs(Manager.error) -- loops over only the error handlers handler_name,hander
names
Sub set to Manger.event and acts as a coverter between event_name and event_id
  • names

See also:

Usage:

    Manager.event[event_name] -- see above, can not be accessed via Manager.event.names
generated by LDoc 1.4.6 Last updated 2018-05-29 20:15:05