getResourceConfig
Client-side
Server-side
Shared
Manual Review Required
Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.
This function is used to return the root node of a configuration file. Config files must be predefined in a resource's meta file. An alternative way to load XML files is to use xmlLoadFile.
Syntax
xmlnode getResourceConfig ( string filePath )Required Arguments
- filePath: The filepath of the file in the following format: ":resourceName/path" . 'resourceName' is the name of the resource the file is in, and 'path' is the path from the root directory of the resource to the file.
Returns
- xmlnode: value
Returns the root node of the specified configuration file. If the file is corrupted, not defined in the meta file or doesn't exist, returns false.
Code Examples
shared
This example opens a configuration file and prints the value of the 'attr' attribute of the first 'group' node.
function resourceStart ( ) -- When the resource is started local node = getResourceConfig( "config.xml" ) -- get the configuration file local subNode = xmlFindChild( node, "group", 0 ) -- get a subnode in it outputChatBox( xmlNodeGetAttribute( subNode, "attr" ),root ) -- output its attributes value to chatboxendaddEventHandler ( "onResourceStart", resourceRoot, resourceStart )See Also
Resource Functions
- abortRemoteRequest
- addResourceConfig
- addResourceMap
- call
- callRemote
- copyResource
- createResource
- deleteResource
- fetchRemote
- getRemoteRequestInfo
- getRemoteRequests
- getResourceACLRequests
- getResourceConfig
- getResourceDynamicElementRoot
- getResourceExportedFunctions
- getResourceFromName
- getResourceGUIElement
- getResourceInfo
- getResourceLastStartTime
- getResourceLoadFailureReason
- getResourceLoadTime
- getResourceMapRootElement
- getResourceName
- getResourceOrganizationalPath
- getResourceRootElement
- getResources
- getResourceState
- getThisResource
- isResourceArchived
- isResourceProtected
- refreshResources
- removeResourceFile
- renameResource
- restartResource
- setResourceInfo
- startResource
- stopResource
- updateResourceACLRequest