getElementsByType
Server
Lists every element of a type below an element of the tree on the server.
Also exists on the client, with its own implementation: getElementsByType
table getElementsByType(string type [, element startAt = root])
Parameters
| Name | Type | Description |
|---|---|---|
| type | string | The type to look for, such as "vehicle" or a type from createElement. |
| startAt | element | The element the search goes down from.default root |
Returns
A table with the elements, empty if there are none.
Example
addCommandHandler("fixall", function()
for _, vehicle in ipairs(getElementsByType("vehicle")) do
fixVehicle(vehicle)
end
end)