GetElementData: Difference between revisions
Jump to navigation
Jump to search
(→Syntax) |
No edit summary |
||
Line 2: | Line 2: | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua">string getElementData ( element, string name )</syntaxhighlight> | |||
==Example== | ==Example== | ||
This example will return the version of the map, generally this will be ''2.0'' in the final release. | This example will return the version of the map, generally this will be ''2.0'' in the final release. | ||
<syntaxhighlight lang="lua">map = getRootElement ( ) | |||
mapVersion = getElementData ( map, "version" )</syntaxhighlight> | |||
Revision as of 03:47, 20 May 2006
Elements can contain data values. These are accessable via names, and their value can be retrieved using getElementData and set using setElementData. These values are also loaded from the attributes in the XML map files, and as such can provide a powerful way to store and retrieve data in XML for each element.
Syntax
string getElementData ( element, string name )
Example
This example will return the version of the map, generally this will be 2.0 in the final release.
map = getRootElement ( ) mapVersion = getElementData ( map, "version" )