Skip to content
lsl.devlsl.devLSL Dev

llName2Key

function
Function syntax
key llName2Key(
  1. string name// Name of the avatar (e.g., 'First Last' or 'first.last').
);
Returns
key
Energy
10

Returns a key the Agent ID for the named agent in the region. If there is no agent with the specified name currently signed onto the region, this function returns the value NULL_KEY. Names are always provided in the form “First[ Last]” or “first[.last]” (first name with an optional last name.) If the last name is omitted a last name of “Resident” is assumed. Case is not considered when resolving agent names.

How to use
key result = llName2Key("");
  • This function does not operate on historical names. For historical name lookup use llRequestUserKey.
Example 1
tellName2Key(string avatarName)
{
key keyFromName = llName2Key(avatarName);
if (keyFromName == NULL_KEY)
{
16 collapsed lines
llSay(0, "There is no agent with the name '" + avatarName + "' currently signed onto the region.");
return;
}
llSay(0, "Avatar key for name '" + avatarName + "': " + (string)keyFromName);
}
default
{
touch_start(integer total_number)
{
tellName2Key("rider.linden");
tellName2Key("Rider Linden");
tellName2Key(llDetectedName(0));
}
}
// If Rider Linden touches the object, the three lines should contain the answer c5a07167-9bbe-4944-a7b0-a9677afa134d

to fetch avatar UUID by current or historical username.

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.

From the Second Life Wiki

Community documentation adapted from LlName2Key, by Linden Research, Inc. and contributing residents.View contributors and history.

Imported wiki revision:

Licensed under CC BY-SA 3.0. Last wiki edit: .Formatting and links have been adapted for this site; API metadata follows the LSL definitions.