SaveMapData: Difference between revisions

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


==Example==
==Example==
Saving your resource's data to an map file (untested)
<syntaxhighlight lang="lua">
local file = xmlCreateFile("saved.map", "map")
if file then
  saveMapData ( file, getResourceRootElement(getThisResource()) )
  xmlUnloadFile ( file )
end
</syntaxhighlight>


==See Also==
==See Also==
{{Map functions}}
{{Map functions}}
[[Category:Needs Example]]
[[Category:Needs Example]]

Revision as of 15:01, 7 January 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)

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.

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()) )
   xmlUnloadFile ( file )
end

See Also