- Documentation
- Server functions
- getResourceRootElement
Function
getResourceRootElement
Returns the resource's root element. Everything the resource creates is its child, and events attached to this root only concern this resource. Without an argument it returns the current resource's root (the same as resourceRoot).
Syntax
element getResourceRootElement([resource theResource])Arguments
theResourceresource, optional- The resource.
Returns
The resource root or false.
Example
local race = getResourceFromName("race")
for _, veh in ipairs(getElementsByType("vehicle", getResourceRootElement(race))) do
setVehicleColor(veh, 255, 122, 34)
end
See also
getResourceDynamicElementRootReturns the root of the elements a resource creates while running. In Trilogy Hub it is the same element asgetResourceRootElement.getResourceMapRootElementReturns the element of a map loaded from the resource's.mapfile; its children are the objects, vehicles and other elements from that map.