GetRemoteRequests: Difference between revisions
Jump to navigation
Jump to search
(Fix links) |
Fernando187 (talk | contribs) (Remove obsolete Requirements section) |
||
(4 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
{{Server client function}} | {{Server client function}} | ||
__NOTOC__ | __NOTOC__ | ||
Gets all [fetchRemote] | {{New feature/item|3.0158|1.5.7|20307| | ||
Gets all [[FetchRemote|fetchRemote]] and [[CallRemote|callRemote]] requests currently running. | |||
}} | |||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
table getRemoteRequests ( [ resource theResource = nil ] ) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 59: | Line 60: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</section> | </section> | ||
==See Also== | ==See Also== | ||
{{Resource functions}} | {{Resource functions}} |
Latest revision as of 17:17, 7 November 2024
Gets all fetchRemote and callRemote requests currently running.
Syntax
table getRemoteRequests ( [ resource theResource = nil ] )
Optional Arguments
- theResource: the resource to get all requests from
Returns
Returns a table with all requests, false if an invalid resource was provided
Example
Click to collapse [-]
ServerThis example prints how many request are currently pending.
function CMD_requestInfo(player, _, resourceName) local res = resourceName and getResourceFromName(resourceName) or not resourceName and nil if(res == false) then outputChatBox("There is no resource named '" .. resourceName .. "'", player) return elseif(res and getResourceState(res) ~= "running") then outputChatBox("The provided resource '" .. resourceName .. "' is not running", player) return end local requests = getRemoteRequests(res) outputChatBox(("There are %d request%s running"):format(#requests, #requests == 1 and '' or 's'), player) end addCommandHandler("requestinfo", CMD_requestInfo)
Click to collapse [-]
ClientThis example prints how many request are currently pending.
function CMD_requestInfo(_, resourceName) local res = resourceName and getResourceFromName(resourceName) or not resourceName and nil if(res == false) then outputChatBox("There is no resource named '" .. resourceName .. "'") return elseif(res and getResourceState(res) ~= "running") then outputChatBox("The provided resource '" .. resourceName .. "' is not running") return end local requests = getRemoteRequests(res) outputChatBox(("There are %d request%s running"):format(#requests, #requests == 1 and '' or 's')) end addCommandHandler("requestinfo", CMD_requestInfo)
See Also
- abortRemoteRequest
- call
- fetchRemote
- getResourceConfig
- getResourceDynamicElementRoot
- getResourceExportedFunctions
- getResourceFromName
- getResourceName
- getResourceRootElement
- getResourceState
- getThisResource
- getRemoteRequests
- getRemoteRequestInfo