Files
Patryk Gensch 198d9cf477 Finished automatically generated docs
Time to correct it by itself
2026-05-20 22:49:46 +02:00

1.8 KiB

STRUCT

A data structure with named, typed fields. In engine scripts it is used exclusively together with DATABASE — it describes a database row's schema and stores the values of the currently pointed-to record after a call to SET.

Fields

FIELDS

STRING FIELDS

The struct's schema, written as a comma-separated list. Each entry has the form NAME<TYPE>, where NAME is the field name and TYPE is the data type. Accepted types: STRING, INTEGER, DOUBLE, BOOLEAN. Type names are case-insensitive; any unrecognised name is treated as STRING.

Methods

GETFIELD

<type> GETFIELD(INTEGER fieldIndex)

Returns the value of the field at the given (zero-based) index. The return type follows the schema — <INTEGER> fields return INTEGER, <DOUBLE> returns DOUBLE, <BOOLEAN> returns BOOL, and everything else returns STRING. Out-of-range indices return an empty value. If the struct has not yet been synchronised with a DATABASE, every field is empty.

Parameters

  • fieldIndex — field index (zero-based).

Returns: the field value, typed according to the schema.

Examples

STLEVEL^GETFIELD(0);

SET

void SET(STRING cursorName)

Synchronises the struct with the row currently pointed to by a DATABASE cursor. Raw cursor values are converted to the types declared in the FIELDS schema.

Parameters

  • cursorName — name of the cursor variable associated with a database.

Examples

SOBJECT^SET("DBOBJECTS_CURSOR");

Signals

ONINIT

Fired when the object is initialised.

ONSIGNAL

Fired when a signal arrives (see Events and signals).