EnglishРусский  
The project is closed! You can look at a new scripting language. It is available on GitHub.
Also, try our open source cross-platform automation software.

Ads

Installer and installation software
Commercial and Freeware installers.

Fields and pointers

Addressing fields

The . statement (dot) is used to get or set the value of a field or to call a method or a property. You should specify the name of the field or property after the dot. You should specify parameters in parentheses in case you call a method.

type customer 
{
   str    name, last_name  
   uint   age
   arrstr phones[ 5 ]
}
...
customer cust1 
cust1.name = "Tom"
cust1.age = 30
cust1.phones[ 0 ] = "3332244"
cust1.process()

Addresses and pointers

The unary operator & gives the address of a local or global variable as well as the address (identifier) of a function. The operation returns the value of uint type. However, if the result of any operation is an object, for example the function which returns a string, the address-of operator is also apllied to the obtained object. The address-of operator &, applied to the object (structure), returns the address of the required object and is used for a type cast to uint type.

uint a b
str mystr
...
a = &mystr
b = &getsomestr
b->func( a ) // equals getsomestr( mystr )

You should use the -> statement to get a value by its address. The first operand must be the name of the numeric type and the left operand must point to the value of the corresponding numeric type.

int a = 10, b
uint addra

addra = &a
b = addra->int // b = 10
addra->int = 3 // a = 3

Array element operation

Many structures or objects can include elements of other types. You can use square brackets [ ] to access the elements of an object ( array elements, string characters ). If an object is a multidimensional one, its dimensions are separated with commas. Elements are counted starting from zero. For you to be able to apply this operation to a variable, its type must have the corresponding index methods. See more details on the System type methods page.

arr myarr[ 10, 10, 10] of byte
str mystr = "abcdef"

myarr[ i, k+3, 4 ] = 'd'
myarr[ 0, 0, 0 ] = mystr[i]

Related links