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

Function

xmlCopyFile

Server and clientXMLIdentical to MTA:SA

Copies a node (with its children and attributes) into a new document at a new path. The copied node becomes the root of the new document, which must be saved with xmlSaveFile.

Syntax

xmlnode xmlCopyFile(xmlnode nodeToCopy, string newFilePath)

Arguments

nodeToCopyxmlnode
The node to copy.
newFilePathstring
The new file path.

Returns

The copy's root node, or false.

Example

local root = xmlLoadFile("config.xml")
local backup = xmlCopyFile(root, "config_backup.xml")
xmlSaveFile(backup)
xmlUnloadFile(backup)
xmlUnloadFile(root)

See also