llReadKeyValue

From Second Life Wiki
Revision as of 13:59, 8 July 2014 by Strife Onizuka (talk | contribs) (will fix this later with a subtype.)
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
       list result = llCSV2List(value);
       if (llList2Integer(result, 0) == 1)
       {
           // the key-value pair was successfully read
           llSay(0, "New key-value pair value: " + llList2String(1));
       }
       else
       {
           // the key-value pair was not created
           llSay(0, "Key-value pair doesn't exist");
       }
   } 
}</lsl>

Deep Notes

Signature

function key llReadKeyValue( string k );