Lgi Scripting Syntax

Variables

Variables are created on demand and don't need to be explicitly declared. Sometimes the host will insert known global variables before the script is run, but that usage pattern is declining as "Main" functions are now used, that allow parameters from outside the script to be passed in via explicit method arguments.

The variables themselves are based on a variant data type, that can contain integers, strings and various pointer types. There is no dereference operator needed to use a pointer type variable. Pointer arithmetic is not supported, as generally the pointers are to single class objects, not arrays of objects. That said there are List and HashTable sub-types to the variables, but no array as such.

Scope

There are 3 fixed scopes: global, local, register. Although in practice when writting code you only ever deal with global and local. Unlike C, there are no extra scope levels inside { } blocks inside a function. Variables defined in that function (including it's arguments) are visible throughout that function. Global variables are defined outside of a function scope and are visible everywhere.

Constructs

Scripts are constructed from these primitives:

Operators

These operators can be used in expressions:
=Assign
+Plus
-Minus
*Multiply
/Divide
%Mod
<LessThan
<=LessThanEqual
>GreaterThan
>=GreaterThanEqual
==Equals
!=Not Equals
+=Plus Equals
-=Minus Equals
*=Multiply Equals
/=Divide Equals
++Post Increment
--Post Decrement
++Pre Increment
--Pre Decrement
&&And
||Or
!Not
.Object member reference

Objects

Some variant types allow the referencing of object members via the '.' operator. The available members depends on the variant type:

List

The list object type allows you to store a bunch of objects in a variable (of the same variant type). To get the length of the list, use var_name.length, and to access the various members use var_name[index_expression] where the exp evaluates to an integer. If you don't specify an integer then you'll get back a NULL variable as the result.

HashTable

HashTable's are very similar to lists, in that they allow you to store a objects in a variable. To get the number of objects in the hash table, use var_name.length, and to access the various members use var_name[index_expression] where the exp evaluates to an string. If you don't specify a string then you'll get back a NULL variable as the result.