Module instance

Instance

Functions

Instance.new () Creates a new Instance.
Instance:addEntity (e) Adds an Entity to the Instance.
Instance:checkEntity (e) Checks an Entity against all the systems in the Instance.
Instance:removeEntity (e) Marks an Entity as removed from the Instance.
Instance:flush () Completely removes all marked Entities in the Instance.
Instance:addSystem (system, eventName, callback, enabled) Adds a System to the Instance.
Instance:enableSystem (system, eventName, callback) Enables a System in the Instance.
Instance:disableSystem (system, eventName, callback) Disables a System in the Instance.
Instance:setSystem (system, eventName, callback, enable) Sets a System 'enable' in the Instance.
Instance:emit (eventName, ...) Emits an Event in the Instance.
Instance:clear () Removes all entities from the Instance
Instance:onEntityAdded (e) Default callback for adding an Entity.
Instance:onEntityRemoved (e) Default callback for removing an Entity.


Functions

Instance.new ()
Creates a new Instance.

Returns:

    The new instance
Instance:addEntity (e)
Adds an Entity to the Instance.

Parameters:

  • e The Entity to add

Returns:

    self
Instance:checkEntity (e)
Checks an Entity against all the systems in the Instance.

Parameters:

  • e The Entity to check

Returns:

    self
Instance:removeEntity (e)
Marks an Entity as removed from the Instance.

Parameters:

  • e The Entity to mark

Returns:

    self
Instance:flush ()
Completely removes all marked Entities in the Instance.

Returns:

    self
Instance:addSystem (system, eventName, callback, enabled)
Adds a System to the Instance.

Parameters:

  • system The System to add
  • eventName The Event to register to
  • callback The function name to call. Defaults to eventName
  • enabled If the system is enabled. Defaults to true

Returns:

    self
Instance:enableSystem (system, eventName, callback)
Enables a System in the Instance.

Parameters:

  • system The System to enable
  • eventName The Event it was registered to
  • callback The callback it was registered with. Defaults to eventName

Returns:

    self
Instance:disableSystem (system, eventName, callback)
Disables a System in the Instance.

Parameters:

  • system The System to disable
  • eventName The Event it was registered to
  • callback The callback it was registered with. Defaults to eventName

Returns:

    self
Instance:setSystem (system, eventName, callback, enable)
Sets a System 'enable' in the Instance.

Parameters:

  • system The System to set
  • eventName The Event it was registered to
  • callback The callback it was registered with. Defaults to eventName
  • enable The state to set it to

Returns:

    self
Instance:emit (eventName, ...)
Emits an Event in the Instance.

Parameters:

  • eventName The Event that should be emitted
  • ... Parameters passed to listeners

Returns:

    self
Instance:clear ()
Removes all entities from the Instance

Returns:

    self
Instance:onEntityAdded (e)
Default callback for adding an Entity.

Parameters:

  • e The Entity that was added
Instance:onEntityRemoved (e)
Default callback for removing an Entity.

Parameters:

  • e The Entity that was removed
generated by LDoc 1.4.6 Last updated 2018-09-25 18:42:43