ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Shared functions
  3. xmlCreateChild

Function

xmlCreateChild

Server and clientXMLIdentical to MTA:SA

Adds a new child node with the given name at the end of the parent's children.

Syntax

xmlnode xmlCreateChild(xmlnode parentNode, string tagName)

Arguments

parentNodexmlnode
The parent.
tagNamestring
The new tag name.

Returns

The new node, or false.

Example

local root = xmlCreateFile("players.xml", "players")
for _, player in ipairs(getElementsByType("player")) do
    local node = xmlCreateChild(root, "player")
    xmlNodeSetAttribute(node, "name", getPlayerName(player))
end
xmlSaveFile(root)
xmlUnloadFile(root)

See also