getElementParent | Multi Theft Auto: Wiki Skip to content

getElementParent

Client-side
Server-side
Shared

Pair: setElementParent

Manual Review Required

Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.


This function is used to determine the parent of an element.

OOP Syntax Help! I don't understand this!

  • Method:element:getParent(...)
  • Variable: .parent

Syntax

element getElementParent ( element theElement )
Required Arguments
  • theElement: The child of the parent element you want returned.

Returns

  • element: value

This returns the parent as an element . It returns false if theElement is invalid, or is the root node.

Code Examples

shared

Consider the following map file:

<spawngroup id="red">
<spawnpoint id="spawnpoint_0" posX="2507.8715820313" posY="2772.6071777344" posZ="10.8203125" rot="270" skin="285"/>
<spawnpoint id="spawnpoint_1" posX="2508.060546875" posY="2780.3647460938" posZ="10.8203125" rot="270" skin="285"/>
</spawngroup>
<spawngroup id="blue">
<spawnpoint id="spawnpoint_5" posX="2733.4184570313" posY="2753.1276855469" posZ="10.8203125" rot="90" skin="124"/>
<spawnpoint id="spawnpoint_6" posX="2733.5258789063" posY="2748.1110839844" posZ="10.8203125" rot="90" skin="125"/>
</spawngroup>

See Also

Element Functions