# getResourceFromName (Shared)

> Finds a resource by name.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Shared
- **Category**: Resources and modules
- **URL**: https://wiki.mymp.gg/en/getResourceFromName

## Syntax

```lua
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

```lua
local chat = getResourceFromName("chat")
if chat then
    outputDebugString(getResourceName(chat) .. " is " .. getResourceState(chat))
end
```

### Coming from MTA

Only a running resource has an element, so a stopped resource gives `nil`. The functions that take a resource also take its name.

## See also

- [getResourceName (Shared)](https://wiki.mymp.gg/en/getResourceName.md): Returns a resource's name.
- [getResources (Shared)](https://wiki.mymp.gg/en/getResources.md): Lists the resources running on this side.
- [getResourceState (Shared)](https://wiki.mymp.gg/en/getResourceState.md): Tells which state a resource is in.
