# llDetectedLinkNumber

*LSL function*

```lsl
integer integer llDetectedLinkNumber(integer number);
```

- `integer number`: Index of the detection information.

- Returns: `integer`
- Energy: 10

Returns the link number (integer) of the triggered event (touches and collisions only) specified by number. Returns 0 for non-linked objects, 1 for the root prim, and 2+ for child prims. Returns 0 if not supported by the event.

For [touch](/categories/touch/) and [collision](https://wiki.secondlife.com/wiki/Category:LSL_Collision) categories of events only.

```lsl title="How to use" frame="terminal"
integer result = llDetectedLinkNumber(0);
```

## Examples

<details open>
<summary>Example 1</summary>

```lsl
default
{
    // Drop this script into the root prim of of a build
    // Touch any prim to learn its link number
    touch_start(integer num_detected)
    {
        llOwnerSay("Link number clicked: " + (string)llDetectedLinkNumber(0));
    }
}
```

</details>

## Known issues

From the issue templates included by the wiki article:

- SVC-2996 (fs): llDetectedLinkNumber returns 0 with llVolumeDetect(TRUE)

## See also

### Functions

- [llDetectedTouchFace](/functions/llDetectedTouchFace/)

### Events

- [touch_start](/events/touch_start/)
- [touch](/events/touch/)
- [touch_end](/events/touch_end/)
- [collision_start](/events/collision_start/)
- [collision](/events/collision/)
- [collision_end](/events/collision_end/)

---

*Source: [LlDetectedLinkNumber](https://wiki.secondlife.com/wiki/LlDetectedLinkNumber) on the Second Life Wiki. Content from the Second Life Wiki articles LlDetectedLinkNumber (revision 1218819, 2026-04-30), Template:Issues/SVC-2996 (revision 1179320, 2013-06-19), Template:HoverText (revision 379053, 2009-06-01) and Template:LSL Function/detected (revision 1168823, 2012-06-11), CC BY-SA 3.0.*

---

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