User Tools

Site Tools



This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
hpl3:community:scripting:classes:tstring [2015/11/06 03:50]
abion47 [Functions]
hpl3:community:scripting:classes:tstring [2015/11/06 04:00] (current)
abion47 [Remarks]
Line 13: Line 13:
 ====Remarks==== ====Remarks====
-Have some helpful descriptions to add to this class? Edit this page and add your insight to the Wiki!+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 ( " ).
 +<​code=c++>​tString sStr = "This is a string.";</​code>​
 +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''​.)
 +<​code=c++>​uint8 c = sStr[1];</​code>​
 +A tString is [[wp>​Null-terminated_string|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</​code>​
hpl3/community/scripting/classes/tstring.txt ยท Last modified: 2015/11/06 04:00 by abion47