Adding JSON constants and functions.

This commit is contained in:
Ima Mechanique 2013-06-22 09:34:16 +01:00
parent cfdec7300b
commit 1f868c91ad
3 changed files with 125 additions and 10 deletions

View file

@ -251,8 +251,7 @@
<Word name="llClearCameraParams">
llClearCameraParams();
Resets all camera parameters to default values and turns
off scripted camera control.
Resets all camera parameters to default values and turns off scripted camera control.
</Word>
<Word name="llClearLinkMedia">
@ -1558,6 +1557,34 @@
Encodes number as an 8-character Base64 string.
</Word>
<Word name="llJson2List">
list llJson2List( string sJSON );
This function takes a string representing JSON, and returns a list of the top level.
Returns a list made by parsing src, a string representing json.
</Word>
<Word name="llJsonGetValue">
string llJsonGetValue( string sJSON, list lSpecifiers );
Gets the value indicated by specifiers from the json string.
Returns a string made by parsing json, a string representing json and traversing as specified by specifiers.
</Word>
<Word name="llJsonSetValue">
string llJsonSetValue( string sJSON, list lSpecifiers, string sValue );
Returns a new JSON string which is string with the value indicated by specifiers set to value.
Returns a string
</Word>
<Word name="llJsonValueType">
string llJsonValueType( string sJSON, list lSpecifiers );
Gets the JSON type for the value in json at the location specifiers.
Returns the string specifying the type of the value at specifiers in json.
</Word>
<Word name="llKey2Name">
string llKey2Name(key id);
@ -1602,6 +1629,13 @@
Returns the integer at index in the list src.
</Word>
<Word name="llList2Json">
string llList2Json( string sType, list lValues );
This function takes a list and returns a JSON string of that list as either a json object or json array.
Returns a string that is either values serialized as a JSON type, or if an error was encountered JSON_INVALID.
</Word>
<Word name="llList2Key">
key llList2Key(list src, integer index);
@ -1611,8 +1645,8 @@
<Word name="llList2List">
list llList2List(list src, integer start, integer end);
Returns the slice of the list from startto end from the list
srcas a new list. The startand end parameters
Returns the slice of the list from start to end of the list
src as a new list. The start and end parameters
are inclusive, so 0,length-1 would copy the entire list and 0,0
would capture the first list entry. Using negative
numbers for startand/or end causes the index to count backwards
@ -2105,12 +2139,6 @@
• string msg message to be transmitted
</Word>
<Word name="llReleaseCamera">
llReleaseCamera(key agent);
A FollowCam function that returns the camera to the key agent after permission to change it with llSetCameraParams has been granted via llRequestPermissions(agent_key, PERMISSION_CONTROL_CAMERA).
</Word>
<Word name="llReleaseControls">
llReleaseControls();
@ -4686,6 +4714,17 @@
</WordsSubsection>
<WordsSubsection name="C.26 JSON constants">
<Word name="JSON_ARRAY" type="string" value="">U+FDD2</Word>
<Word name="JSON_FALSE" type="string" value="">U+FDD7</Word>
<Word name="JSON_INVALID" type="string" value="">U+FDD0</Word>
<Word name="JSON_NULL" type="string" value="">U+FDD5</Word>
<Word name="JSON_NUMBER" type="string" value="">U+FDD3</Word>
<Word name="JSON_OBJECT" type="string" value="">U+FDD1</Word>
<Word name="JSON_STRING" type="string" value="">U+FDD4</Word>
<Word name="JSON_TRUE" type="string" value="">>U+FDD6</Word>
</WordsSubsection>
<WordsSubsection name="C.99. Miscellaneous constants.">
Constants that do not fit into any of the previously defined categories.
<Word name="AGENT_LIST_PARCEL" />

View file

@ -6,6 +6,33 @@
<body style="background-color: white; font-family: Verdana, sans-serif;font-size: 13px;line-height: 1.3">
<div>
<div>
<h3><span class="date">2013-06-22</span> - Release 2.52.0</h3>
<p>Added the JSON related constants and functions.</p>
<div>
* Constants Added:
<ul>
<li>JSON_ARRAY</li>
<li>JSON_FALSE</li>
<li>JSON_INVALID</li>
<li>JSON_NULL</li>
<li>JSON_NUMBER</li>
<li>JSON_OBJECT</li>
<li>JSON_STRING</li>
<li>JSON_TRUE</li>
<li></li>
</ul>
</div>
<div>
* Functions added:
<ul>
<li>llList2Json</li>
<li>llJson2List</li>
<li>llJsonGetValue</li>
<li>llJsonSetValue</li>
<li>llJsonValueType</li>
</ul>
</div>
<h3><span class="date">2013-05-16</span> - Release 2.51.0</h3>
<div>
* Constants Added:

View file

@ -401,6 +401,15 @@ namespace LSLEditor
public static readonly integer INVENTORY_ANIMATION = 20;
public static readonly integer INVENTORY_GESTURE = 21;
public static readonly string JSON_ARRAY = "\uFDD2";
public static readonly string JSON_FALSE = "\uFDD7";
public static readonly string JSON_INVALID = "\uFDD0";
public static readonly string JSON_NULL = "\uFDD5";
public static readonly string JSON_NUMBER = "\uFDD3";
public static readonly string JSON_OBJECT = "\uFDD1";
public static readonly string JSON_STRING = "\uFDD4";
public static readonly string JSON_TRUE = "\uFDD6";
public static readonly integer KFM_CMD_PAUSE = 2;
public static readonly integer KFM_CMD_PLAY = 0;
public static readonly integer KFM_CMD_STOP = 1;
@ -2743,6 +2752,38 @@ namespace LSLEditor
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // E0
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; // F0
public list llJson2List(string sJSON)
{
//TODO implement conversion to list
list lJSON = new list();
Verbose("llJson2List({0})={1}", sJSON, lJSON);
return lJSON;
}
public string llJsonGetValue(string sJSON, list lSpecifiers)
{
//TODO determine return value from list
string sReturn = JSON_INVALID;
Verbose("llJsonGetValue({0}, {1})= {2}", sJSON, lSpecifiers, sReturn);
return sReturn;
}
public string llJsonSetValue(string sJSON, list lSpecifiers, string sValue)
{
//TODO determine return value
string sReturn = JSON_INVALID;
Verbose("llJsonGetValue({0}, {1}, {2})= {3}", sJSON, lSpecifiers, sValue, sReturn);
return sReturn;
}
public string llJsonValueType(string sJSON, list lSpecifiers)
{
//TODO determine return value
string sReturn = JSON_INVALID;
Verbose("llJsonGetValue({0}, {1})= {2}", sJSON, lSpecifiers, sReturn);
return sReturn;
}
public String llKey2Name(key id)
{
string strName = "*unknown*";
@ -2801,6 +2842,14 @@ namespace LSLEditor
return result;
}
public string llList2Json(string sType, list lValues)
{
//TODO determine return value
string sReturn = JSON_INVALID;
Verbose("llList2Json({0}, {1})= {2}", sType, lValues, sReturn);
return sReturn;
}
public key llList2Key(list src, integer index)
{
key result;