RestartResource: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 1: | Line 1: | ||
__NOTOC__ | {{Server function}} | ||
__NOTOC__ | |||
This function restarts a running resource. | This function restarts a running resource. | ||
Line 8: | Line 9: | ||
===Required Arguments=== | ===Required Arguments=== | ||
*'''theResource:''' the [[resource]] | *'''theResource:''' the [[resource]] you want to restart. | ||
===Returns=== | ===Returns=== | ||
Line 17: | Line 18: | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function restartAllResources() | function restartAllResources() | ||
--we store a table of resources | -- we store a table of resources | ||
local allResources = getResources() | local allResources = getResources() | ||
--for each one of them, | -- for each one of them, | ||
for index, | for index, res in ipairs(allResources) do | ||
--if it's running, | -- if it's running, | ||
if getResourceState( | if getResourceState(res) == "running" then | ||
--then restart it | -- then restart it | ||
restartResource( | restartResource(res) | ||
end | end | ||
end | end |
Revision as of 14:57, 16 August 2007
This function restarts a running resource.
Syntax
bool restartResource ( resource theResource )
Required Arguments
- theResource: the resource you 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, res in ipairs(allResources) do -- if it's running, if getResourceState(res) == "running" then -- then restart it restartResource(res) end end end
See Also
- abortRemoteRequest
- call
- fetchRemote
- getResourceConfig
- getResourceDynamicElementRoot
- getResourceExportedFunctions
- getResourceFromName
- getResourceName
- getResourceRootElement
- getResourceState
- getThisResource
- getRemoteRequests
- getRemoteRequestInfo