Difference between revisions of "Quake c string"

From QuakeQEWiki
Jump to navigation Jump to search
Line 1: Line 1:
Quake C strings are one of the primitive types of Quake C. They are zero-terminated sequences of characters.  Vanilla quake c offers no straightforward ways to modify a string once it is created and no way to combine existing strings into a new string.
Quake C strings are one of the primitive types of Quake C. They are zero-terminated sequences of characters (meaning a series of ascii letters).  Vanilla quake c offers no straightforward ways to modify a string once it is created and no way to combine existing strings into a new string.


In quake-c code, double quotation marks delimit the start and end of a string.
<code>local string myString = "The Rune of Black Magic throbs evilly in your hand";</code>
== Escape Charaters ==
Much like the C programming language, strings in QuakeC have escape characters:
Much like the C programming language, strings in QuakeC have escape characters:
{| class="wikitable"
{| class="wikitable"
Line 22: Line 27:
| }
| }
|}
|}
== Trivia ==
The 2021 release uses curly-braces as a delimiter/replacement shorthand
The 2021 release uses curly-braces as a delimiter/replacement shorthand


Line 30: Line 37:
file paths are strings
file paths are strings


====== see also: ======
The maximum length of a string is 2048 characters
 
== see also: ==
[[ftos]] creates a string from a floating point number
[[ftos]] creates a string from a floating point number


[[vtos]] creates a string representation of a vector
[[vtos]] creates a string representation of a vector
[[WriteString]] - sends a string to the quake engine
[[Category:Primitive]]
[[Category:Primitive]]

Revision as of 07:26, 24 March 2022

Quake C strings are one of the primitive types of Quake C. They are zero-terminated sequences of characters (meaning a series of ascii letters). Vanilla quake c offers no straightforward ways to modify a string once it is created and no way to combine existing strings into a new string.

In quake-c code, double quotation marks delimit the start and end of a string.

local string myString = "The Rune of Black Magic throbs evilly in your hand";

Escape Charaters

Much like the C programming language, strings in QuakeC have escape characters:

character result
\n new line
\" "
\0 unknown
{{ {
}} }

Trivia

The 2021 release uses curly-braces as a delimiter/replacement shorthand

Searching through the existing entities in the world of quake can be done by strings

Strings can be printed/output to screen with a number of different methods

file paths are strings

The maximum length of a string is 2048 characters

see also:

ftos creates a string from a floating point number

vtos creates a string representation of a vector

WriteString - sends a string to the quake engine