GetResourceState: Difference between revisions
Jump to navigation
Jump to search
(add oop syntax) |
mNo edit summary |
||
Line 10: | Line 10: | ||
===Required Arguments=== | ===Required Arguments=== | ||
*'''theResource:''' The resource you wish to get the | *'''theResource:''' The resource you wish to get the state of. | ||
{{OOP||[[resource]]:getState|state}} | {{OOP||[[resource]]:getState|state}} | ||
===Returns=== | ===Returns=== |
Revision as of 12:48, 23 August 2018
This function returns the state of a given resource
Syntax
string getResourceState ( resource theResource )
Required Arguments
- theResource: The resource you wish to get the state of.
OOP Syntax Help! I don't understand this!
- Method: resource:getState(...)
- Variable: .state
Returns
If successful returns a string with the resource state in it, false otherwise. The state can be one of:
- loaded
- running
- starting
- stopping
- failed to load - Use getResourceLoadFailureReason to find out why it failed.
Example
This example returns the state of a given resource. Syntax: /state <Resource Name>
function getState( player, command, resourceName ) if resourceName then local resource = getResourceFromName( resourceName ) if resource then outputChatBox( "Resource State: " .. resourceName .. " is currently " .. getResourceState( resource ) .. ".", player, 0, 0, 255 ) else outputChatBox( "Error: No resource with name " .. resourceName .. " exists.", player, 255, 0, 0 ) end else outputChatBox( "Syntax: " .. command .. " [resource name]", player, 255, 0, 0 ) end end addCommandHandler( "state", getState )
See Also
- abortRemoteRequest
- call
- fetchRemote
- getResourceConfig
- getResourceDynamicElementRoot
- getResourceExportedFunctions
- getResourceFromName
- getResourceName
- getResourceRootElement
- getResourceState
- getThisResource
- getRemoteRequests
- getRemoteRequestInfo