llKeysKeyValue

From Second Life Wiki
Revision as of 12:33, 8 July 2014 by Jeremy Linden (talk | contribs) (Created page with "Category:Experience Tools {{LSL_Function |func=llKeysKeyValue |func_desc=Start an asynchronous transaction to request a number of keys. |func_footnote= The dataserver callbac…")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Summary

Function: key llKeysKeyValue( integer first, integer count );

Start an asynchronous transaction to request a number of keys.
Returns a key Returns the ID of the transaction.

• integer first Zero-based index of the first key to retrieve
• integer count Number of keys to retriever

The dataserver callback parameters are:

  • A key containing the transaction ID returned from llKeysKeyValue
  • A string containing a comma-delimited list. The first item is a boolean specifying if the transaction succeeded (1) or not (0). On a success result the remaining items are key names. This function will attempt to retrieve the number requested but may return less if there are not enough to fulfill the full amount requested or if the list is too large. The order keys are returned is not guaranteed but is stable between subsequent calls as long as no keys are added or removed. The error XP_ERROR_KEY_NOT_FOUND is returned if there index given is greater than or equal to the number of keys.

Examples

<lsl>key trans; default {

   state_entry()
   {
       // retrieve the first 10 keys
       trans = llKeysKeyValue(0, 10);
   }

}

dataserver(key t, string value) {

   if (t == trans)
   {
       // our llKeyCountKeyValue transaction is done
       list result = llCSV2List(value);
       if (llList2Integer(result, 0) == 1)
       {
           llSay(0, "Keys retrieved: "+llGetSubString(value, -1);
       }
       else if (llList2String(result, 1) == "key doesn't exist")
       {
           // no more keys
           llSay(0, "No more keys" );
       }
       else
       {
           // keys request failed
           llSay(0, "Key-value failed to request keys: " + llList2String(result, 1) );
       }
   } 
}</lsl>

Deep Notes

Signature

function key llKeysKeyValue( integer first, integer count );