GetResources: Difference between revisions
Jump to navigation
Jump to search
m (Removed Template:Needs_Checking: You can't achieve it directly with getElementsByType, that returns a list of resource root elements.) |
(add oop syntax) |
||
| Line 6: | Line 6: | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
table getResources () | table getResources () | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP||[[Resource]].getAll}} | |||
===Returns=== | ===Returns=== | ||
Revision as of 18:26, 24 June 2017
This function retrieves a table of all the resources that exist on the server.
Syntax
table getResources ()
OOP Syntax Help! I don't understand this!
- Method: Resource.getAll(...)
Returns
Returns a table of resources.
Example
This function lists all loaded resources in the console.
function displayResources()
outputConsole("List of resources:")
local resourceTable = getResources() -- get a table of resources
for resourceKey, resourceValue in ipairs(resourceTable) do
-- iterate through the table and output each resource's name
local name = getResourceName(resourceValue)
outputConsole(" " .. name)
end
end
See Also
- abortRemoteRequest
- call
- fetchRemote
- getResourceConfig
- getResourceDynamicElementRoot
- getResourceExportedFunctions
- getResourceFromName
- getResourceName
- getResourceRootElement
- getResourceState
- getThisResource
- getRemoteRequests
- getRemoteRequestInfo