Skip to content

llCreateKeyValue

functionRequires an experience
Function syntax
key llCreateKeyValue(
  1. string k,// Unique key name for the key-value pair
  2. string v// Value for the key-value pair (maximum 2047 characters, or 4095 characters if using Mono)
);
Returns
key
Energy
10

Start an asynchronous transaction to create a key-value pair associated with the script’s Experience using the given key (k) and value (v).

If the key already exists the dataserver will return a failure along with the error XP_ERROR_STORAGE_EXCEPTION.

As of Jan 1, 2016 maximum bytes is 1011 for key and 4095 for value for both LSO and Mono scripts.

Returns a key that can be used to identify the corresponding dataserver event to determine if this command succeeded or failed.

How to use
key result = llCreateKeyValue("", "");
  • It is recommended that keys do not contain commas due to llKeysKeyValue returning keys in CSV format.
  • The script must be compiled with an experience selected, or the call fails with XP_ERROR_NO_EXPERIENCE. The experience does not need to be allowed on the land: key-value calls work wherever the script runs1
Example 1
key trans;
default
{
touch_start(integer total_number)
{
trans = llCreateKeyValue("FOO", "BAR");
}
dataserver(key t, string value)
{
if (t == trans)
{
// our llCreateKeyValue transaction is done
integer result = (integer)llGetSubString(value, 0, 0);
if (result == 1)
{
// the key-value pair was successfully created
11 collapsed lines
llSay(0, "New key-value pair was created");
}
else
{
// the key-value pair was not created
integer error = (integer)(llGetSubString(value, 2, -1));
llSay(0, "Key-value failed to create: " + llGetExperienceErrorMessage(error));
}
}
}
}
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.

  1. Confirmed in-world by Nexii Malthus (October 2026). The wiki and the LSL definitions only state that the script must be compiled into an experience; land allowance applies to llRequestExperiencePermissions and what it grants ↩