M MY Multiplayer: Wiki
Side
Kind

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

NameTypeDescription
typestringThe type to look for, such as "vehicle" or a type from createElement.
startAtelementThe 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)

See also