Navigation: battleWarden:Script > API Reference >

Tables

 

 

Since eScript Basic does not support any data structures like arrays and dictionaries, the Tables module was implemented in battleWarden:Script. The purpose of this module is to provide you a way for structuring data. It can be compared with a dictionary as you can assign values (integer, string) to keys.

Tables Module API

Syntax

Parameters

Return Value

Description

CreateTable() AS INTEGERPTR

none

Pointer to the created table.

Creates a new table by allocating memory.

FreeTable(table AS INTEGERPTR) AS VOID

table: specifies a pointer to an existing table.

none

Frees an existing table by deallocating its memory.

SetInteger(table AS INTEGERPTR, key AS STRING, value AS INTEGER)

table: specifies a pointer to an existing table.

 

key: specifies an identifier for the value to be stored in the table.

 

value: specifies a value to be stored in the table.

none

Adds a new integer value and its specified key to an existing table. In case there is already an element with the specified key, it will be replaced.

SetString(table AS INTEGERPTR, key AS STRING, value AS STRING)

table: specifies a pointer to an existing table.

 

key: specifies an identifier for the value to be stored in the table.

 

value: specifies a value to be stored in the table.

none

Adds a new string and its specified key to an existing table. In case there is already an element with the specified key, it will be replaced

GetInteger(table AS INTEGERPTR, key AS STRING) AS INTEGER

table: specifies a pointer to an existing table.

 

key: specifies an identifier of an existing value.

Value of the specified key. If the key does not exist, the return value will be 0.

Returns the value of the specified key.

GetString(table AS INTEGERPTR, key AS STRING) AS STRING

table: specifies a pointer to an existing table.

 

key: specifies an identifier of an existing value.

String of the specified key. If the key does not exist, the return value will be an empty string.

Returns the string of the specified key.

Copyright © 2016 solicus. All Rights Reserved. Last Update: 2016-4-7.