Finished automatically generated docs

Time to correct it by itself
This commit is contained in:
Patryk Gensch
2026-05-20 22:49:46 +02:00
parent df6cf2f3d3
commit 198d9cf477
35 changed files with 6120 additions and 73 deletions

View File

@@ -0,0 +1,63 @@
# STRUCT
A data structure with named, typed fields. In engine scripts it is used exclusively together with [`DATABASE`](DATABASE.md) — it describes a database row's schema and stores the values of the currently pointed-to record after a call to [`SET`](#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`](INTEGER.md), `<DOUBLE>` returns [`DOUBLE`](DOUBLE.md), `<BOOLEAN>` returns [`BOOL`](BOOL.md), and everything else returns [`STRING`](STRING.md). Out-of-range indices return an empty value. If the struct has not yet been synchronised with a [`DATABASE`](DATABASE.md), 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`](DATABASE.md) cursor. Raw cursor values are converted to the types declared in the [`FIELDS`](#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](../engine/events.md#onsignal)).