Skip to main content

Entity Class

Description:

  A class for creating and managing entities in the ECS game systems.

count

Type: Readonly Field.

Description:

  The number of all running entities.

Signature:

const count: integer

clear

Type: Function.

Description:

  A function that clears all entities.

Signature:

clear: function(self: EntityClass)

__call

Type: Metamethod.

Description:

  A metamethod that creates a new entity with the specified components. And you can then get the newly created Entity object from groups and observers.

Signature:

metamethod __call: function(self: EntityClass, coms: {string: Item})

Usage:

Entity({ a = 1, b = "abc", c = Node() })

Parameters:

ParameterTypeDescription
coms{string: Item}A table mapping component names (strings) to component values (Items).