Witcher 3 Native Datatypes

From Witcher Wiki
Jump to: navigation, search

Integer Types[edit | edit source]

An integer is a "a number that can be written without a fractional component". If an integer is expressed in a number of bits, that is an indication of how large a number can be stored inside.

int[edit | edit source]

int (short for integer) is a 32-bit integral data type. Its value can ranges from −2,147,483,647 to 2,147,483,647 (unlike true 32-bit integer which can go down to −2,147,483,648. When an integer is assigned a value that is out of range, the Witcher Script compilation process outputs "error: Integer Overflow".

Int8[edit | edit source]

Probably 8 bit integer

Uint64[edit | edit source]

Probably unsigned 64 bit integer

float[edit | edit source]

Probably single precision floating point number.

string[edit | edit source]

Representation of a sequence of characters, like a sentence. Literals are declares with double quotes (example: "This is an example string").

name[edit | edit source]

Seems to be a special kind of string that is treated differently at compile time. Literals are declared with single quotes (example: 'NameExample'). Names seem to be able to reference functions and can be passed during runtime to provide a reference to them. Because names are often references to something, they are short and unique, and it is likely that name literals are interned (while string literals are not) for better time and space efficiency.

hint[edit | edit source]

Seems to be another special type of string, declared with the same name as another variable (generally marked as editable to provide context. Declared just like a string.

bool[edit | edit source]

Boolean type, can be set to either true or false and used to evaluate conditions.

array[edit | edit source]

A set of values of a certain type. Arrays in Witcher Script seem to have no set length, or they have dynamic, resizable capacity. Declared with the stored datatype in angle brackets (example: array<int> for an integer array).