GetRootElement: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
This function returns the root node for the element tree, called ''map''. This represents the ''map'' node at the root of the XML document that contains map data.
This function returns the root node for the [[element tree]], called ''map''. This represents the ''map'' node at the root of the XML document that contains map data.
 
This is a special element that is consistent across map changes. It is never destroyed and cannot be destroyed using [[destroyElement]]. It contains directly, or indirectly every other element in the map.


==Syntax==
==Syntax==
<syntaxhighlight lang="lua">element getRootElement ()</syntaxhighlight>
<syntaxhighlight lang="lua">
element getRootElement ()
</syntaxhighlight>
 
===Returns===
Returns the root [[element]] object.


==Example==
==Example==
Line 10: Line 17:
version = getElementData ( root, "version" )
version = getElementData ( root, "version" )
</syntaxhighlight>
</syntaxhighlight>
{{Element_Functions}}

Revision as of 13:31, 20 May 2006

This function returns the root node for the element tree, called map. This represents the map node at the root of the XML document that contains map data.

This is a special element that is consistent across map changes. It is never destroyed and cannot be destroyed using destroyElement. It contains directly, or indirectly every other element in the map.

Syntax

element getRootElement ()

Returns

Returns the root element object.

Example

This example will retrieve the version of the currently loaded map, by reading the version argument from the root element of the element tree.

root = getRootElement ()
version = getElementData ( root, "version" )

Template:Element Functions