getResourceName
Client-side
Server-side
Shared
Pair: renameResource
Manual Review Required
Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.
This function gets the name of the specified resource.
Note
Every resource has a predefined global variable called resourceName whose value is the name of that resource.
Note
If you want to access the name of any resource-data you should use getElementID .
OOP Syntax Help! I don't understand this!
- Method: resource:getName(...)
- Variable: .name
Syntax
string getResourceName ( [ [ resource res = getThisResource( ] )Optional Arguments
NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use.
- resource res (default: getThisResource(): MISSING_PARAM_DESC
Returns
- string: value
Returns a string with the resource name in it, or false if the resource does not exist.
Code Examples
shared
This simple example outputs a message in the console whenever a resource starts, stating the name of the resource.
addEventHandler("onResourceStart", getRootElement(), function(res) outputConsole("Resource " .. getResourceName(res) .. " just started.") end)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