llReadKeyValue

From Second Life Wiki
Revision as of 11:17, 9 July 2014 by Dolphin Linden (talk | contribs) (Updated result parsing in the example)
Jump to navigation Jump to search

Summary

Function: key llReadKeyValue( string k );

Start an asynchronous transaction to read the value associated with the specified key and the specified experience.
Returns the key id of the transaction.

• string k The key for the key-value pair

The dataserver callback parameters are:

  • A key containing the transaction ID returned from llReadKeyValue
  • A string containing a comma-delimited list. The first item is a boolean specifying if the transaction succeeded (1) or not (0). The second item is a string with a status/error message if it failed or the value if the transaction succeeded.

Examples

<lsl>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")
           {
               // 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));
           }
       } 
   }
}</lsl>

Deep Notes

Search JIRA for related Issues

Signature

function key llReadKeyValue( string k );