Skip to content

GetEntities

Every entity in the world, or every entity of one kind.

GetEntities([kind])
Parameter Type
kind number ENTITY_HORSE, ENTITY_ITEM, ENTITY_NPC, ENTITY_PROP or ENTITY_DOG; without it, every kind (optional)

table - a list of entity ids

-- horses nobody controls for ten minutes are removed
for _, id in ipairs(GetEntities(ENTITY_HORSE)) do
if GetEntityController(id) == nil and GetEntityIdleTime(id) > 600 then DestroyEntity(id) end
end

GetEntityKind · GetNearestEntity · DestroyEntity · the World entities group of the index