From Frictional Wiki
< HPL3‎ | SOMA‎ | Scripting
Jump to navigation Jump to search

A tString is the HPL3 type for storing strings, or sequences of characters. They are created through use of a string literal, or a series of characters surrounded by quotation marks ( " ).

tString sStr = "This is a string.";


tString has no public fields.


Return Type Function Name Parameters Description
uint64 length Returns the length of the tString.
void resize uint64 alLength Resizes the tString, removing characters and adding null characters as necessary.


A thing to note is that a tString is essentially a wrapper for an array of characters, meaning that you can retrieve characters within a tString by using square bracket ( [ ] ) syntax. (Characters in the HPL3 engine are represented by unsigned 8-bit integers, or uint8.)

uint8 c = sStr[1];

A tString is null-terminated, meaning that when a tString is read (for example, in a cLux_AddDebugMessage function), the tString will only process its characters until it reaches a null-character, and characters after the null-character, if any, are ignored.

sStr[0] = 'H';
sStr[1] = 'i';
sStr[2] = '\0'; // This is a null-character
sStr[3] = 'Q';
sStr[4] = '9';

// The message as printed: 
// Hi


See all references...