renameResource
Client-side
Server-side
Shared
Pair: getResourceName
Manual Review Required
Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.
This function renames a resource.
OOP Syntax Help! I don't understand this!
- Method: resource:rename(...)
- Variable: .name
Syntax
bool renameResource ( string/resource theResource, string newResourceName, string organizationalPath )Required Arguments
- theResource: The name of resource or the resource you want to rename.
- newResourceName: The name of what the resource should be renamed to.
- organizationalPath: If you want to store the new resource inside a category.
Returns
- bool: value
Returns true if the resource has been renamed successfully, false otherwise. This could fail if the resource name already is in use, if a directory already exists with the name you've specified (but this isn't a valid resource) or if the name you specify isn't valid. It could also fail if the disk was full or for other similar reasons. Won't work on a started resource or if the resource is not loaded (not known by MTA (use /refresh))
Code Examples
shared
This example renames the resource "reload" to "reload2":
function renameReloadResource() renameResource("reload", "reload2");endaddEventHandler("onResourceStart", resourceRoot, renameReloadResource);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