Advertisement
L1ghtsh0w

Untitled

Oct 25th, 2016
645
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.     Example of how to use nested lists
  3.     in LSL using Json.
  4. */
  5.  
  6. default
  7. {
  8.     touch_start(integer total_number)
  9.     {
  10.          // Equivalent to:
  11.          //   json = [ [a, 1], [b, 2], [c, 3] ]
  12.         string json = "[[[a, 1], [b, 2], [c, 3]]]";
  13.        
  14.          // This is just for the example on
  15.          // line 27
  16.         string json2 = "[[a, 1], [b, 2], [c, 3]]";
  17.  
  18.          // Equivalent to:
  19.          //   json[0][1]
  20.          // Or in this case:
  21.          //   [b, 2]
  22.         list ind = [0, 1];
  23.  
  24.          // Equivalent to the string value of:
  25.          //   [b, 2]
  26.         string k = llJsonGetValue( json, ind );
  27.  
  28.         llSay( 0, /*"Original string:\n*/"json = " + json2 );
  29.         llSay( 0, /*"Index to retrieve:\n*/"json[" + llList2String( ind, 0 ) + "][" + llList2String( ind, 1 ) + "]" );
  30.         llSay( 0, /*"Return:\n"*/ k );
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement