old Entity API - latibro/Automation-Mod GitHub Wiki
API to access entities (Entity).
The Entity API may be obtained using the [Interface Box API](Interface Box API).
Usage
local entityAPI = interfaceBox.getAPI("entity")
function getAllLoaded() : array<entity : userdata<Entity>>
Returnes all currently loaded entities.
Entities are only loaded when they are in a loaded chunk.
Returns
- array (table) of Entity (userdata)
Usage
local entities = entityAPI.getAllLoaded()
function getAllLoadedAsUUID() : array<uuid : string>
Returnes the UUID of all loaded entities.
Entities are only loaded when they are in a loaded chunk.
Returns
- array (table) af UUID (string)
Usage
local entities = entityAPI.getAllLoadedAsUUID()
function getByUUID(uuid: string) : userdata<Entity>
Returns the entity with the gives UUID.
This will only return to entity if the entity is currently loaded.
Entities are only loaded when they are in a loaded chunk.
Parameters
- UUID (string) of the entity
Returns
- Entity (userdata) with the given UUID (or nil on errors)
Errors
- Entity is not loaded
Usage
local entity = entityAPI.getByUUID("f2654a86-f752-4109-9279-ce67b46c3a4e")