SaveMapData: Difference between revisions
Jump to navigation
Jump to search
(→Syntax) |
|||
Line 4: | Line 4: | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> bool saveMapData(xmlnode node, element baseElement)</syntaxhighlight> | <syntaxhighlight lang="lua"> bool saveMapData ( xmlnode node, element baseElement [, bool childrenOnly ] )</syntaxhighlight> | ||
===Required Arguments=== | ===Required Arguments=== | ||
*'''node''': An existing node that should contain the contents of baseElement | *'''node''': An existing node that should contain the contents of baseElement | ||
*'''baseElement''': The first element to output to the xml tree. This element and all its children (and their children, etc) will be output. | *'''baseElement''': The first element to output to the xml tree. This element and all its children (and their children, etc) will be output. | ||
===Optional Arguments=== | |||
*'''childrenOnly''': Defines if you want to only save children of the specified element. | |||
===Returns=== | ===Returns=== |
Revision as of 12:19, 24 May 2008
This converts a set of elements in the element tree into XML. This is a format that can then be loaded as a map file. Each element represents a single XML node.
Syntax
bool saveMapData ( xmlnode node, element baseElement [, bool childrenOnly ] )
Required Arguments
- node: An existing node that should contain the contents of baseElement
- baseElement: The first element to output to the xml tree. This element and all its children (and their children, etc) will be output.
Optional Arguments
- childrenOnly: Defines if you want to only save children of the specified element.
Returns
Example
Saving your resource's data to an map file (untested)
local file = xmlCreateFile("saved.map", "map") if file then saveMapData ( file, getResourceRootElement(getThisResource()) ) xmlSaveFile ( file ) xmlUnloadFile ( file ) end