XmlSaveFile: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
(add oop syntax)
Line 5: Line 5:
==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">bool xmlSaveFile ( xmlnode rootNode ) </syntaxhighlight>
<syntaxhighlight lang="lua">bool xmlSaveFile ( xmlnode rootNode ) </syntaxhighlight>
 
{{OOP||[[xmlnode]]:save}}
===Required Arguments===  
===Required Arguments===  
*'''rootNode:''' the root [[xmlnode]] of the loaded XML file.
*'''rootNode:''' the root [[xmlnode]] of the loaded XML file.

Revision as of 20:21, 2 January 2015

This function saves a loaded XML file.

Syntax

bool xmlSaveFile ( xmlnode rootNode ) 

OOP Syntax Help! I don't understand this!

Method: xmlnode:save(...)


Required Arguments

  • rootNode: the root xmlnode of the loaded XML file.

Returns

Returns true if save was successful, false if the XML file does not exist.

Example

Click to collapse [-]
Client

This example allows a player to use the command 'createfile' to create an .xml file.

-- Creates a file named "new.xml" with root node "newroot" and childnode "newchild".
function createFileHandler()
local RootNode = xmlCreateFile("new.xml"," newroot")
local NewNode = xmlCreateChild(RootNode, "newchild")
xmlSaveFile(RootNode)
end

addCommandHandler("createfile", createFileHandler)

See Also