xmlDestroyNode
Client-side
Server-side
Shared
This function destroys a XML node from the XML node tree.
OOP Syntax Help! I don't understand this!
- Method: xmlnode:destroy(...)
Syntax
bool xmlDestroyNode ( xmlnode theXMLNode )
Required Arguments
- theXMLNode: The xmlnode you want to destroy.
Returns
- bool: bool
Returns true if the xml node was successfully destroyed, false otherwise.
Code Examples
server
This example will add a command called /delnode and it will create an xml file called test.xml.
addEventHandler("onResourceStart", resourceRoot, function() xml = xmlLoadFile("test.xml") if (not xml) then xml = xmlCreateFile("test.xml", "root") xmlCreateChild(xml, "node") xmlSaveFile(xml) endend)
addCommandHandler("delnode", function(player) local node = xmlFindChild(xml, "node", 0) if (not node) then xmlUnloadFile(xml) return end
xmlDestroyNode(node) xmlSaveFile(xml) xmlUnloadFile(xml) outputChatBox("You destroyed the node!", player, 0, 255, 0, false)end)