You are looking at the HTML representation of the XML format.
HTML is good for debugging, but is unsuitable for application use.
Specify the format parameter to change the output format.
To see the non HTML representation of the XML format, set format=xml.
See the complete documentation, or
API help for more information.
<?xml version="1.0"?>
<api>
<query-continue>
<allpages gapcontinue="XMREngine.builtins" />
</query-continue>
<query>
<pages>
<page pageid="3" ns="0" title="XMREngine.advflowctl">
<revisions>
<rev contentformat="text/x-wiki" contentmodel="wikitext" xml:space="preserve">Provide advanced flow-control statements similar to other programming
languages.
Enabled by: xmroption advflowctl;
Keywords:
break
case
constant
continue
switch
...
:
&&&
|||
'break' : valid in 'do', 'for', 'foreach', 'switch', 'while'
'continue' : valid in 'do', 'for', 'foreach', 'while'
'&&&' : provides short-circuiting AND operation
left-hand operand evaluated before right-hand operand
right-hand operand evaluated only if left-hand operand is true
'|||' : provides short-circuiting OR operation
left-hand operand evaluated before right-hand operand
right-hand operand evaluated only if left-hand operand is false
'constant' usage as follows:
'constant' name '=' constantexpr ';'
constantexpr := floatconstant | integerconstant | stringconstant | constantexpr constbinop constantexpr | constunop constantexpr
constbinop := '+' | '-' | '*' | '/' | '%' | '&' | '|' | '^'
constunop := '-' | '~'
name is defined to be the same type as constantexpr
Note: & | ^ ~ require all integer operands
- * / % require either integer or float operands
only + is valid for strings
'switch' usage as follows :
'switch' '(' integerexpression ')' '{'
[ 'case' integerconstantexpression [ '...' integerconstantexpression ']' ':' singlestatement ]*
[ 'default' ':' singlestatement ]
'}'
the switch statement is also valid for string expressions, for example:
switch (command) {
case "turnleft": {
TurnLeft ();
break;
}
case "turnright": {
TurnRight ();
break;
}
default: llOwnerSay ("dont know how to handle " + command);
}</rev>
</revisions>
</page>
<page pageid="4" ns="0" title="XMREngine.arrays">
<revisions>
<rev contentformat="text/x-wiki" contentmodel="wikitext" xml:space="preserve">ASSOCIATIVE ARRAYS
Arrays are associative in that the index can be any immutable type, and any
given array can have a mix of index types and a mix of value types. In
particular, the index of an array can be a list to provide multiple-dimension
array functionality.
(Note: For fixed-dimension arrays, see [[XMREngine.objects]]).
The index can be type float, key, list, integer, rotation, string, vector.
Unlike other LSL script types, arrays are mutable. So, unlike lists, arrays
can be passed to a function, the function can modify the array, and the caller
will see the changes made by the function, all without any array copying.
Enabled by: xmroption arrays;
Keywords:
array declare variable to be an array, and make it initially empty
foreach iterate through all elements in an array
in keyword part of foreach statement
is test array element to be a particular type
object declare variable that can hold any type
undef test object or array element to hold undefined element
Declare an array:
'array' name ';'
Example:
array ar;
Insert or replace element:
name '[' index ']' '=' value ';'
name : was declared with 'array' statement
index : lsl value of type float, key, list, integer, rotation, string, vector
value : lsl value of any type
Examples:
ar[3] = "abcdef";
ar["five"] = [ "one", "two", "three" ];
ar[5.0,"six"] = 7;
Delete element:
name '[' index ']' '=' undef ';'
it is not an error to delete an element that does not exist
Example:
ar["five"] = undef;
Retrieve element:
name '[' index ']'
if element not defined, return value is 'undef'
Example:
llOwnerSay((string)ar[3]);
Test type of object:
<object> is <type> => integer 0 or 1
<object> is undef => integer 0 or 1
object o;
if (o is integer) ...
if (o is string) ... etc
Methods and Properties:
ar.clear() // empty array, returns type void
ar.count // get number of elements in array, returns type integer
ar.index(i) // get index of i'th (zero based) element, returns type object
ar.value(i) // get value of i'th (zero based) element, returns type object
Iterate through all elements:
array ar;
object k;
object v;
foreach (k,v in ar) {
k holds the index
v holds the value
llOwnerSay("ar[" + (string)k + "]=" + (string)v);
}
// alternatively:
object k;
object v;
integer n = ar.count;
for (integer i = 0; i < n; i ++) {
k = ar.index(i);
v = ar.value(i);
llOwnerSay((string)i + ": ar[" + (string)k + "]=" + (string)v);
}</rev>
</revisions>
</page>
</pages>
</query>
</api>