GetRootElement: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 5: Line 5:


==Example==
==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.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
root = getRootElement ()
root = getRootElement ()
version = getElementData ( root, "version" )
version = getElementData ( root, "version" )
</syntaxhighlight>
</syntaxhighlight>

Revision as of 21:04, 17 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.

Syntax

element getRootElement ()

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