# llGetObjectName

*LSL function*

```lsl
string string llGetObjectName();
```

- Returns: `string`
- Energy: 10

:::note
This function **does not** get the name of the object's rootprim, but the name of the prim containing the script. Please use [llGetLinkName](/functions/llGetLinkName/)([LINK_ROOT](/constants/LINK_ROOT/)); instead.
:::

Returns a [string](https://wiki.secondlife.com/wiki/string) that is the name of the *prim* the script is attached to.

```lsl title="How to use" frame="terminal"
string result = llGetObjectName();
```

## Caveats

- The prim name is limited to 63 bytes, any string longer than that will be truncated. This truncation does not always happen when the attribute is set or read.
- This function may return "(Waiting)" sometimes. See: [notes](#notes)

## Examples

<table>
	<tr>
		<th>**Get this prim's name**</th>
		<th>**Get the root prim's name**</th>
	</tr>
	<tr>
		<td>

			```lsl
			default
			{
			    state_entry()
			    {
			    //  PUBLIC_CHANNEL has the integer value 0
			        llSay(PUBLIC_CHANNEL, "This prim's name: " + llGetObjectName() );
			    }
			}
			```

		</td>
		<td>

			```lsl
			default
			{
			    state_entry()
			    {
			    //  PUBLIC_CHANNEL has the integer value 0
			        llSay(PUBLIC_CHANNEL, "Root prim's name: "
			            + llGetLinkName(LINK_ROOT));
			    }
			}
			```

		</td>
	</tr>
</table>

## Notes

#### Erroneous "(Waiting)"

Presumably the function queries the asset server for a predetermined time and returns "(Waiting)" if that elapses.

It then silently proceeds to the next instruction.

A work around therefore, might be to test object name is not "(Waiting)" after calling `llGetObjectName`.

## See also

### Functions

- [llSetObjectName](/functions/llSetObjectName/) — Set the prims name
- [llGetLinkName](/functions/llGetLinkName/) — Get a linked prims name
- [llGetObjectDesc](/functions/llGetObjectDesc/) — Get the prims description
- [llSetObjectDesc](/functions/llSetObjectDesc/) — Sets the prims description
- [llGetObjectDetails](/functions/llGetObjectDetails/)

### Articles

- [Prim Attribute Overloading](https://wiki.secondlife.com/wiki/Prim_Attribute_Overloading)

---

*Source: [LlGetObjectName](https://wiki.secondlife.com/wiki/LlGetObjectName) on the Second Life Wiki. Content from the Second Life Wiki articles LlGetObjectName (revision 1194216, 2015-01-22) and Template:LSL Function/limits (revision 1168817, 2012-06-11), CC BY-SA 3.0.*

---

From lsl.dev: https://lsl.dev/functions/llGetObjectName/
