xmlNodeSetAttribute
Client-side
 Server-side
 Shared
 Pair: xmlNodeGetAttribute
This function is used to edit an attribute of a node in a configuration file.
OOP Syntax Help! I don't understand this!
- Method: xmlnode:setAttribute(...)
Syntax
bool xmlNodeSetAttribute ( xmlnode node, string name, string|number|nil value )Required Arguments
- node: The xmlnode of which you wish to edit an attribute.
- name: The name of the attribute.
- value: The value which you wish to change the attribute to. (Note - nil will delete the attribute).
Returns
- bool: result
Returns true if the attribute was set successfully, false if the node and/or attribute do not exist, or if they're faulty.
Code Examples
 server   
 In a gamemode, we want a command to change the marker color in the configuration file and remove a deprecated attribute.
config.xml
<config>    <markers color="255,100,0" foo="deprecated" /></config>Lua code
function changeConfigMarkerColor(thePlayer, command, r, g, b)    local config = xmlLoadFile("config.xml")    if (not config) then        return    end
    local markernode = xmlFindChild(config, "markers", 0)    if (markernode) then        xmlNodeSetAttribute(markernode, "color", r .. "," .. g .. "," .. b)        xmlNodeSetAttribute(markernode, "foo", nil) -- remove 'foo' attribute    end
    xmlSaveFile(config)    xmlUnloadFile(config)endaddCommandHandler("markercolor", changeConfigMarkerColor) 
 