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

Function

xmlNodeSetAttribute

Server and clientXMLIdentical to MTA:SA

Sets a node attribute; numbers and other values are converted to text. nil or false removes the attribute.

Syntax

bool xmlNodeSetAttribute(xmlnode node, string name, string value)

Arguments

nodexmlnode
The node.
namestring
Attribute name.
valuestring
The value, or nil/false to remove.

Returns

true on success.

Example

local root = xmlCreateFile("pos.xml", "pos")
local x, y, z = 2495, -1665, 13
xmlNodeSetAttribute(root, "x", x)
xmlNodeSetAttribute(root, "y", y)
xmlNodeSetAttribute(root, "z", z)
xmlSaveFile(root)
xmlUnloadFile(root)

See also