getResourceFromName
Shared
Finds a resource by name.
resource|nil getResourceFromName(string name)
Parameters
| Name | Type | Description |
|---|---|---|
| name | string | The resource's name, the name of its folder. |
Returns
The resource, or nil if there is no resource with that name or it is not running.
Example
local chat = getResourceFromName("chat")
if chat then
outputDebugString(getResourceName(chat) .. " is " .. getResourceState(chat))
endComing from MTAOnly a running resource has an element, so a stopped resource gives
nil. The functions that take a resource also take its name.