llGetLinkName
function
Function syntax
string llGetLinkName(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
string result = llGetLinkName(0);Caveats
Section titled “Caveats”- If link is out of bounds,
NULL_KEYis 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.
Examples
Section titled “Examples”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 + "\""); } }}Helper functions
Section titled “Helper functions”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.}Known issues
Section titled “Known issues”From the issue templates included by the wiki article:
- SVC-600 (bug): llGetLinkKey returns the wrong result when passed LINK_THIS
See also
Section titled “See also”Functions
Section titled “Functions”llGetLinkKey— Gets the instance UUID of the linkllGetObjectName— Get the prims namellSetObjectName— Set the prims namellGetObjectDesc— Get the prims descriptionllSetObjectDesc— Set the prims descriptionllGetObjectDetails
Articles
Section titled “Articles”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.