# getElementID (Shared)

> Reads an element's ID, the name `getElementByID` looks for.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Shared
- **Category**: Elements
- **URL**: https://wiki.mymp.gg/en/getElementID

## Syntax

```lua
string getElementID(element element)
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `element` | `element` | The element to read. |

## Returns

The ID, or an empty string if the element has none.

## Example

```lua
for _, object in ipairs(getElementsByType("object", resourceRoot)) do
    outputDebugString(getElementID(object))
end
```

## See also

- [setElementID (Shared)](https://wiki.mymp.gg/en/setElementID.md): Gives an element an id (a name), to find it later with getElementByID.
- [getElementByID (Shared)](https://wiki.mymp.gg/en/getElementByID.md): Finds the first element with an ID, starting at an element and going down through its children.
