QuakeServer.Extensions.Strings (quake_server v0.1.0)

Copy Markdown View Source

FTE's string builtins: length, joining, cutting, searching, comparing, case, number conversion, sprintf, and the tokenizers whose tokens argv reads back.

The tokens live in the host's ext.tokens as {text, start, stop}.

Summary

Functions

Run string builtin builtin (a number or a name).

The {key, value} pairs of an info string such as \\name\\player\\team\\red.

A number read from the front of text as atof reads it into a 32-bit float, 0.0 when there is none (QuakeServer.TextNumbers.atof/1).

Tokens of text as Quake's parser reads them: quoted strings whole, { } ( ) ' : alone.

Tokens of text as the console reads a command: quoted strings whole, words split at spaces.

Functions

call(s, arg2, argc)

@spec call(map(), integer() | String.t(), non_neg_integer()) :: map()

Run string builtin builtin (a number or a name).

info_pairs(info)

@spec info_pairs(String.t()) :: [{String.t(), String.t()}]

The {key, value} pairs of an info string such as \\name\\player\\team\\red.

number(text)

@spec number(String.t()) :: float()

A number read from the front of text as atof reads it into a 32-bit float, 0.0 when there is none (QuakeServer.TextNumbers.atof/1).

tokenize(text)

@spec tokenize(String.t()) :: [{String.t(), non_neg_integer(), non_neg_integer()}]

Tokens of text as Quake's parser reads them: quoted strings whole, { } ( ) ' : alone.

tokenize_console(text)

@spec tokenize_console(String.t()) :: [
  {String.t(), non_neg_integer(), non_neg_integer()}
]

Tokens of text as the console reads a command: quoted strings whole, words split at spaces.