XmlCreateChild: Difference between revisions
Jump to navigation
Jump to search
(add oop syntax) |
IMr.Wifi..! (talk | contribs) |
||
Line 14: | Line 14: | ||
==Example== | ==Example== | ||
This example allows a player to use the command 'createfile' to create an .xml file. | This example allows a player to use the command 'createfile' to create an .xml file. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
Line 26: | Line 25: | ||
addCommandHandler("createfile", createFileHandler) | addCommandHandler("createfile", createFileHandler) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{XML functions}} | {{XML functions}} | ||
[[ru:xmlCreateChild]] | [[ru:xmlCreateChild]] |
Revision as of 12:28, 23 October 2017
This function creates a new child node under an XML node.
Syntax
xmlnode xmlCreateChild ( xmlnode parentNode, string tagName )
OOP Syntax Help! I don't understand this!
- Method: xmlnode:createChild(...)
Required Arguments
- parentNode: the xmlnode you want to create a new child node under.
- tagName: the type of the child node that will be created.
Returns
Returns the created xmlnode if successful, false otherwise.
Example
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)