RestartResource: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
This function restarts a resource. | |||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
bool restartResource ( resource ) | bool restartResource ( resource theResource ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
===Required Arguments=== | ===Required Arguments=== | ||
*'''theResource:''' the resource we want to restart. | |||
*''' | |||
===Returns=== | ===Returns=== | ||
Returns ''true'' if the resource was restarted, ''false'' if the restart failed, or an invalid resource was passed. | |||
Returns ''true'' if | |||
==Example== | ==Example== | ||
This function restarts all running resources. | |||
This | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
-- | function restartAllResources() | ||
--we store a table of resources | |||
-- | local allResources = getResources() | ||
--for each one of them, | |||
for index, resource in allResources do | |||
--if it's running, | |||
if getResourceState(resource) == "running" then | |||
--then restart it | |||
restartResource(resource) | |||
end | |||
end | |||
end | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{Resource_functions}} | |||
{{ | |||
Revision as of 11:37, 22 April 2007
This function restarts a resource.
Syntax
bool restartResource ( resource theResource )
Required Arguments
- theResource: the resource we want to restart.
Returns
Returns true if the resource was restarted, false if the restart failed, or an invalid resource was passed.
Example
This function restarts all running resources.
function restartAllResources() --we store a table of resources local allResources = getResources() --for each one of them, for index, resource in allResources do --if it's running, if getResourceState(resource) == "running" then --then restart it restartResource(resource) end end end
See Also
- abortRemoteRequest
- call
- fetchRemote
- getResourceConfig
- getResourceDynamicElementRoot
- getResourceExportedFunctions
- getResourceFromName
- getResourceName
- getResourceRootElement
- getResourceState
- getThisResource
- getRemoteRequests
- getRemoteRequestInfo