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

Function

xmlNodeGetAttribute

Server and clientXMLIdentical to MTA:SA

Returns the value of a node attribute as text (convert numbers with tonumber).

Syntax

string xmlNodeGetAttribute(xmlnode node, string name)

Arguments

nodexmlnode
The node.
namestring
Attribute name.

Returns

The value, or false when the attribute does not exist.

Example

local root = xmlLoadString('<car model="411" price="150000"/>')
local price = tonumber(xmlNodeGetAttribute(root, "price"))
xmlUnloadFile(root)

See also