- Documentation
- Server functions
- getResourceConfig
Function
getResourceConfig
Opens a resource's XML config file (e.g. <config src="settings.xml"/> from meta.xml) and returns its root node. Read it with the xml* functions and close it with xmlUnloadFile at the end.
Syntax
xmlnode getResourceConfig(string filePath)Arguments
filePathstring- The file path in the resource.
Returns
The root node or false.
Example
local config = getResourceConfig("ustawienia.xml")
if config then
local start = xmlFindChild(config, "start", 0)
outputServerLog("Pieniądze na start: " .. tostring(start and xmlNodeGetAttribute(start, "money")))
xmlUnloadFile(config)
end
See also
xmlNodeGetAttributeReturns the value of a node attribute as text (convert numbers withtonumber).xmlUnloadFileFrees a document from memory. All its nodes become invalid. Unsaved changes are lost.addResourceConfigAdds a config file (<config src type>) to themeta.xmlof a resource – your own, or one this script created withcreateResource. Adding the same file twice changes nothing.