LSL has the issue where some lists need to be typed,
cough
llSetLinkPrimitiveParams
cough
.
It's important to be able to store types when storing a string, say to either a remote server, or
llLinkSetData
, or even just transmitting it from one object to another.
The design philosophy behind this idea is three points:
  1. Be compact
  2. Be easy to implement (for residents who need to make code to do this)
  3. Solve the issue
The functions are:
*
string llList2TypedString(list data);
*
list llTypedString2List(string data);
The syntax is as follows:
*
i
precedes a integer, if no integer is found, it represents 0. (Hexidecimal is supported because of
std::stoi
)
*
r
("r" as in Real!) precedes a float, if no float is found, it represents 0. Preceding zero are optional for values between 0 and 1.
*
v
precedes a vector, if no vector is found, it represents zero. If any value is zero, it may be omitted. I.E.
v,1
is valid for
<0,1,0>
, as well as
v,,1
being for
<0,0,1>
.
*
q
precedes a quaternion, it shares the same behavior as a vector (Quite literally the same code!)
*
k
precedes a key. It reads exactly 36 BYTES, unless the first byte is "-"
*
s
precedes a string. It is defined by specifying a integer length, followed by a colon, then the string. If no string or simply a semicolon, it represents a empty string.
* Lists are unsupported, lists may not contain lists.
* Any of the above may be combined in series to form a list.
I've provided a lscript implementation at the top of this post.