GetAttachedElements: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
m (fix oop syntax) |
||
(7 intermediate revisions by 6 users not shown) | |||
Line 7: | Line 7: | ||
table getAttachedElements ( element theElement ) | table getAttachedElements ( element theElement ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP||[[element]]:getAttachedElements||}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
Line 15: | Line 16: | ||
==Example== | ==Example== | ||
<section name="Server" class="server" show="true"> | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
-- Print a list of all the players attached to the specified element | -- Print a list of all the players attached to the specified element | ||
Inf = getElementByID ( "infernus1" ) | local Inf = getElementByID ( "infernus1" ) | ||
attachedElements = getAttachedElements ( Inf ) | local attachedElements = getAttachedElements ( Inf ) | ||
if ( attachedElements ) then -- if we got the table | if ( attachedElements ) then -- if we got the table | ||
attachedElementsList = "none" | local attachedElementsList = "none" | ||
-- Loop through the table | -- Loop through the table | ||
for ElementKey, ElementValue in attachedElements do | for ElementKey, ElementValue in ipairs ( attachedElements ) do | ||
-- add their name to the list | -- add their name to the list | ||
if ( getElementType ( ElementValue ) == "player" ) then | if ( getElementType ( ElementValue ) == "player" ) then | ||
if ( attachedElementsList == "none" ) then | if ( attachedElementsList == "none" ) then | ||
attachedElementsList = | attachedElementsList = getPlayerName ( ElementValue ) | ||
else | else | ||
attachedElementsList = attachedElementsList .. ", " .. | attachedElementsList = attachedElementsList .. ", " .. getPlayerName ( ElementValue ) | ||
end | end | ||
end | end | ||
Line 35: | Line 37: | ||
end | end | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</section> | |||
==See Also== | ==See Also== | ||
{{Element functions}} | {{Element functions}} |
Latest revision as of 14:50, 1 January 2015
This function returns a table of all the elements attached to the specified element
Syntax
table getAttachedElements ( element theElement )
OOP Syntax Help! I don't understand this!
- Method: element:getAttachedElements(...)
Required Arguments
- theElement: The element which you require the information from.
Returns
Returns a table of all the elements attached to the specified element.
Example
Click to collapse [-]
Server-- Print a list of all the players attached to the specified element local Inf = getElementByID ( "infernus1" ) local attachedElements = getAttachedElements ( Inf ) if ( attachedElements ) then -- if we got the table local attachedElementsList = "none" -- Loop through the table for ElementKey, ElementValue in ipairs ( attachedElements ) do -- add their name to the list if ( getElementType ( ElementValue ) == "player" ) then if ( attachedElementsList == "none" ) then attachedElementsList = getPlayerName ( ElementValue ) else attachedElementsList = attachedElementsList .. ", " .. getPlayerName ( ElementValue ) end end end outputConsole ( "Players attached to the infernus: " .. attachedElementsList ) end
See Also
- 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