Index       Console Variables

trap_Cvar_VariableStringBuffer

Description

Get the value of a cvar as a string.

Prototype

    void trap_Cvar_VariableStringBuffer(
        const char *var_name,
        char *buffer,
        int bufsize
    );

Parameters

var_name : name of cvar.
buffer : destination string buffer.
bufsize : maximum limit of string buffer.

Remarks

Copies the content of a cvar named by var_name into a mod-space string.
This is useful for obtaining cvar contents that are not bound, or cannot be bound, to a vmCvar_t variable in the mod code.
The terminating NULL is attached to the end of the copied string by this trap, guaranteeing buffer holds a null-terminated string.
The total number of characters copied, including terminating NULL, fits within the size specified by bufsize, truncating the string if necessary.
A nonexistent cvar provides an empty string. An existing cvar with empty content also provides an empty string. Thus, this trap is not sufficient to determine if a cvar actually exists or not.
This trap does not create a new cvar; to create a new cvar during run-time, you can use trap_Cvar_Set or trap_SendConsoleCommand.

Return value

This function has no return value.

See also

trap_Cvar_VariableIntegerValue

Author(s)

PhaethonH


QuakeIII trap calls reference