createResource
Client-side
Server-side
Shared
This page is incomplete! Help wanted!
Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.
This function creates an new, empty resource. This creates a directory matching the name you specify on disk, then creates an empty meta.xml file with a <meta> element in it.
Syntax
createResource ( )Code Examples
server
This example creates a new resource named what the player specified. The command is "/new-resource
function createNewResource ( source, command, resourceName ) -- Define the source and add a resourceName argument. if ( resourceName ) then -- Check if they entered a resource name, and if they did... local resourceName = tostring ( resourceName ) -- Convert the name into a string. local newResource = createResource ( resourceName ) -- Create the new resource. if ( newResource ) then -- Check if the resource has been created, if so then... outputChatBox ( "New resource created succcessfully.", source, 255, 0, 0 ) -- Output it's done. else -- If the resource wasn't made successfully then... outputChatBox ( "An un-expected error occured.", source, 255, 0, 0 ) -- Output it failed. end else -- If they didn't enter a resource name... outputChatBox ( "Please specify a name for your new resource.", source, 255, 0, 0 ) -- Tell them to specify a name. endendaddCommandHandler ( "new-resource", createNewResource ) -- Make it trigger when somebody types "/new-resource <name>".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