Skip to content
lsl.devlsl.devLSL Dev

llReadKeyValue

functionRequires an experience
Function syntax
key llReadKeyValue(
  1. string k// Key of the key-value pair to read.
);
Returns
key
Energy
10

Start an asynchronous transaction to read the value associated with the specified key (k) and the script’s Experience.

If the key does not exist the dataserver will return a failure along with the error XP_ERROR_KEY_NOT_FOUND.

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

How to use
key result = llReadKeyValue("");
Example 1
key trans;
default
{
state_entry()
{
trans = llReadKeyValue("FOO");
}
dataserver(key t, string value)
{
if (t == trans)
{
// our llReadKeyValue transaction is done
if (llGetSubString(value, 0, 0) == "1")
{
12 collapsed lines
// the key-value pair was successfully read
llSay(0, "New key-value pair value: " + llGetSubString(value, 2, -1));
}
else
{
// the key-value pair failed to read
integer error = (integer)llGetSubString(value, 2, -1);
llSay(0, "Key-value failed to read: " + llGetExperienceErrorMessage(error));
}
}
}
}

The wiki article also includes shared templates whose conditional content is not reproduced here: Template:Issues/BUG-8895.

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.