HU/getRootElement: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 4: | Line 4: | ||
It is often used to attach handler functions to events triggered for any element, or also to make a scripting function affect all elements. | It is often used to attach handler functions to events triggered for any element, or also to make a scripting function affect all elements. | ||
{{ | {{Node|All resources have a [[Predefined_variables_list|predefined global variable]] called ''root'' that has the root element as value. The variable exists server side as well as client side.}} | ||
==Szintaxis== | ==Szintaxis== |
Revision as of 14:10, 19 July 2018
Ez a függvény visszaadja az elemfa gyökér csomópontját, melyet root-nak hívnak. Ez a csomópont minden más elemet tartalmaz: minden resource gyökérelemet, játékosokat és távoli klienseket. Sosem lehet megsemmisíteni, még destroyElement használatával sem.
It is often used to attach handler functions to events triggered for any element, or also to make a scripting function affect all elements. Template:Node
Szintaxis
element getRootElement ( )
Visszaadott érték
Visszaadja a gyökér elemet.
Példa
Ez a példa kiírja a betöltött resourcek számát a resource elemek számolásával, amelyek a gyökér csomópont gyermekei.
--By default, predefined variable 'root' is getRootElement() local rootChildren = getElementChildren( root ) local resourceCount = 0 for k, child in ipairs( rootChildren ) do if getElementType( child ) == "resource" then resourceCount = resourceCount + 1 end end outputChatBox( "There are " .. resourceCount .. " loaded resources." )
Lásd még
- attachElements
- createElement
- destroyElement
- detachElements
- getAttachedElements
- getElementAlpha
- getElementAttachedOffsets
- getElementAttachedTo
- getElementByIndex
- getElementByID
- getElementChild
- getElementChildren
- getElementChildrenCount
- getElementCollisionsEnabled
- getElementColShape
- getElementData
- getAllElementData
- hasElementData
- getElementDimension
- getElementHealth
- getElementID
- getElementInterior
- getElementMatrix
- getElementModel
- getElementParent
- getElementPosition
- getElementRotation
- getElementsByType
- getElementsWithinColShape
- getElementsWithinRange
- getElementType
- getElementVelocity
- getLowLODElement
- getRootElement
- isElement
- isElementAttached
- isElementCallPropagationEnabled
- isElementDoubleSided
- isElementFrozen
- isElementInWater
- isElementLowLOD
- isElementWithinColShape
- isElementWithinMarker
- setElementAlpha
- setElementAngularVelocity
- getElementAngularVelocity
- setElementAttachedOffsets
- setElementCallPropagationEnabled
- setElementCollisionsEnabled
- setElementData
- setElementDimension
- setElementDoubleSided
- setElementFrozen
- setElementHealth
- setElementID
- setElementInterior
- setElementModel
- setElementParent
- setElementPosition
- setElementRotation
- setElementVelocity
- setLowLODElement
- getPedContactElement
- getResourceDynamicElementRoot
- getResourceRootElement
Fordította
Surge