FTE's builtins that write entities as text and read them back, as its PR_SaveEnt
and PR_RestoreEnt, and that list or protect entities:
generateentitydata— an entity as{ "field" "value" … }, every field that is not all zero, by the program's field order,_x/_y/_zparts left outwritetofile(606) — the same text added to a file open for writingparseentitydata(613) — text from a byte offset read into an entity: the offset after it, or 0 when there is no{loadfromdata(529),loadfromfile(530) — every{ … }of a string, or of a game file, made into a new entity: 0, or -1 for an empty string or a missing filefind_list— the entities whose field holds a value, compared by the given type, as a list of entity numbers ending in 0 (in fresh memory); the count goes to the fourth argumententityprotection— marks an entity read only (1) or not (0) and returns the value given;find_listof strings passes over read-only entities
Text is read as QuakeC source is tokenized (// and /* */ comments, quoted strings
with \", \\, \n, \r and \t). A key starting _ is ignored, angle sets
the yaw of angles and light sets light_lev when there is no light field. An
entity given no keys is freed. Values: a string as written, numbers as C's strtod
and strtol read them, a vector as three numbers, a field by name, a function by name
after any N: prefix. Written values: a float or vector whole when it is whole, else
with six decimals (%f) or six significant digits (%g); a function as 0:name; a
string with \n, \" and \\ escaped.
Summary
Functions
Run entity text builtin builtin (a number or a name).
Read one { … } from text into entity (a new one when nil), as FTE's
PR_RestoreEnt: {host, entity, bytes_used}, or nil when the text holds no entity.
Entity entity as FTE's PR_SaveEnt writes it.
The next token of text as QuakeC's QCC_COM_Parse reads it and the text after it, or :eof.
Field offset of entity, of type type, as text the way FTE's PR_UglyValueString
writes a value: functions as 0:name, whole floats and vectors without decimals,
strings with newlines, quotes and backslashes escaped.
Functions
@spec call(map(), integer() | String.t(), non_neg_integer()) :: map()
Run entity text builtin builtin (a number or a name).
@spec restore(map(), String.t(), non_neg_integer() | nil) :: {map(), non_neg_integer(), non_neg_integer()} | nil
Read one { … } from text into entity (a new one when nil), as FTE's
PR_RestoreEnt: {host, entity, bytes_used}, or nil when the text holds no entity.
@spec save(map(), non_neg_integer()) :: String.t()
Entity entity as FTE's PR_SaveEnt writes it.
The next token of text as QuakeC's QCC_COM_Parse reads it and the text after it, or :eof.
@spec value(map(), non_neg_integer(), atom(), non_neg_integer()) :: String.t()
Field offset of entity, of type type, as text the way FTE's PR_UglyValueString
writes a value: functions as 0:name, whole floats and vectors without decimals,
strings with newlines, quotes and backslashes escaped.