GetRootElement: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
Line 5: Line 5:
==Syntax==
==Syntax==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
element getRootElement ()
element getRootElement ( void )
</syntaxhighlight>
</syntaxhighlight>



Revision as of 09:49, 31 July 2007

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 ( void )

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" )

See Also