Skip to content
lsl.devlsl.devLSL Dev

llGetLinkName

function
Function syntax
string llGetLinkName(
  1. integer link// Link number (1 for root, >1 for children) or a LINK_* flag. Values: Link
);
Returns
string
Energy
10

Returns a string containing the name of the linked prim specified by link.

Returns a string that is the name of link in link set

How to use
string result = llGetLinkName(0);
  • If link is out of bounds, NULL_KEY is returned.
  • The prim name attribute is limited to 63 bytes, any string longer then that will be truncated. This truncation does not always happen when the attribute is set or read.
  • There is no corresponding llSetLinkName, use llSetLinkPrimitiveParamsFast(link, [PRIM_NAME, name]); instead.
Listen on channel 10 for a name; check if a prim with that name is part of this object
integer check_for_prim(string name)
{
integer i = llGetNumberOfPrims();
for (; i >= 0; --i)
{
if (llGetLinkName(i) == name)
{
return TRUE;
}
}
return FALSE;
19 collapsed lines
}
default
{
state_entry()
{
llListen(10, "", llGetOwner(), "");
}
listen(integer chan, string obj, key id, string msg)
{
if (check_for_prim(msg))
{
llOwnerSay("found a linked prim named \"" + msg + "\"");
}
else
{
llOwnerSay("this object does not have any linked prims named \"" + msg + "\"");
}
}
}
integer getLinkWithName(string name) {
integer i = llGetLinkNumber() != 0; // Start at zero (single prim) or 1 (two or more prims)
integer x = llGetNumberOfPrims() + i; // [0, 1) or [1, llGetNumberOfPrims()]
for (; i < x; ++i)
if (llGetLinkName(i) == name)
return i; // Found it! Exit loop early with result
return -1; // No prim with that name, return -1.
}

From the issue templates included by the wiki article:

  • SVC-600 (bug): llGetLinkKey returns the wrong result when passed LINK_THIS
Original wiki source

Some wiki templates and tables need their original context. View this article on the Second Life Wiki. Technical wording and examples are retained from the source; historical guidance may differ from current behavior.