M MY Multiplayer: Wiki
Side
Kind

getResourceFromName

Shared

Finds a resource by name.

resource|nil getResourceFromName(string name)

Parameters

NameTypeDescription
namestringThe 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))
end
Coming from MTAOnly a running resource has an element, so a stopped resource gives nil. The functions that take a resource also take its name.

See also