Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Example of how to use nested lists
- in LSL using Json.
- */
- default
- {
- touch_start(integer total_number)
- {
- // Equivalent to:
- // json = [ [a, 1], [b, 2], [c, 3] ]
- string json = "[[[a, 1], [b, 2], [c, 3]]]";
- // This is just for the example on
- // line 27
- string json2 = "[[a, 1], [b, 2], [c, 3]]";
- // Equivalent to:
- // json[0][1]
- // Or in this case:
- // [b, 2]
- list ind = [0, 1];
- // Equivalent to the string value of:
- // [b, 2]
- string k = llJsonGetValue( json, ind );
- llSay( 0, /*"Original string:\n*/"json = " + json2 );
- llSay( 0, /*"Index to retrieve:\n*/"json[" + llList2String( ind, 0 ) + "][" + llList2String( ind, 1 ) + "]" );
- llSay( 0, /*"Return:\n"*/ k );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement