core/fmt

fmt

Types

4

Info

Info :: struct { state: Info_State, writer: io.Writer, arg: any, indirection_level: int, record_level: int, optional_len: Maybe(int), use_nul_termination: bool, n: int, }Source

Internal data structure that stores the required information for formatted printing

Register_User_Formatter_Error

Register_User_Formatter_Error :: enum int { None = 0, No_User_Formatter = 1, Formatter_Previously_Found = 2, }Source

Example User Formatter: SomeType :: struct {

value: int,
}
// Custom Formatter for SomeType
User_Formatter :: proc(fi: ^fmt.Info, arg: any, verb: rune) -> bool {
	m := cast(^SomeType)arg.data
	switch verb {
	case 'v', 'd':
		fmt.fmt_int(fi, u64(m.value), true, 8 * size_of(SomeType), verb)
	case:
		return false
	}
	return true
}
main :: proc() {
	// Ensure the fmt._user_formatters map is initialized
	fmt.set_user_formatters(new(map[typeid]fmt.User_Formatter))
	err := fmt.register_user_formatter(type_info_of(SomeType).id, User_Formatter)
	assert(err == .None)
	// Use the custom formatter
	x := SomeType{42}
	fmt.println("Custom type value: ", x)
}

Variables

5

Procedures

89

_arg_number

_arg_number :: proc(format: string, offset: ^int, arg_count: int) -> (index: int, parsed: bool, ok: bool)Source

Parses an argument number from a format string and determines if it's valid

  • format: The format string to parse
  • offset: A pointer to the current position in the format string
  • arg_count: The total number of arguments
  • index: The parsed argument index
  • parsed: A boolean indicating if an argument number was parsed
  • ok: A boolean indicating if the parsed argument number is within arg_count

_fmt_float_as

_fmt_float_as :: proc( fi: ^Info, v: f64, bit_size: int, verb: rune, float_fmt: u8, prec: int, )Source

Formats a floating-point number with a specific format and precision.

  • fi: Pointer to the Info struct containing format settings.
  • v: The floating-point number to format.
  • bit_size: The size of the floating-point number in bits (16, 32, or 64).
  • verb: The format specifier character.
  • float_fmt: The byte format used for formatting the float (either 'f' or 'e').

NOTE: Can return "NaN", "+Inf", "-Inf", "+<value>", or "-<value>".

_fmt_int

_fmt_int :: proc( fi: ^Info, u: u64, base: int, is_signed: bool, bit_size: int, digits: string, )Source

Formats an integer value with specified base, sign, bit size, and digits

  • fi: A pointer to an Info structure
  • u: The integer value to format
  • base: The base for integer formatting
  • is_signed: A boolean indicating if the integer is signed
  • bit_size: The bit size of the integer
  • digits: A string containing the digits for formatting

WARNING: May panic if the width and precision are too big, causing a buffer overrun

_fmt_int_128

_fmt_int_128 :: proc( fi: ^Info, u: u128, base: int, is_signed: bool, bit_size: int, digits: string, )Source

Formats an int128 value based on the provided formatting options.

  • fi: A pointer to the Info struct containing formatting options.
  • u: The int128 value to be formatted.
  • base: The base to be used for formatting the integer (e.g. 2, 8, 10, 12, 16).
  • is_signed: Whether the value should be treated as signed or unsigned.
  • bit_size: The number of bits of the value (e.g. 64, 128).
  • digits: A string containing the digit characters to use for the formatted integer.

WARNING: Panics if the formatting options result in a buffer overrun.

_fmt_memory

_fmt_memory :: proc(fi: ^Info, u: u64, is_signed: bool, bit_size: int, units: string)Source

Formats an integer value as bytes with the best representation.

  • fi: A pointer to an Info structure
  • u: The integer value to format
  • is_signed: A boolean indicating if the integer is signed
  • bit_size: The bit size of the integer
  • digits: A string containing the digits for formatting

_pad

_pad :: proc(fi: ^Info, s: string)Source

Pads a formatted string with the appropriate padding, based on the provided formatting options.

  • fi: A pointer to the Info struct containing formatting options.
  • s: The string to be padded.

_parse_int

_parse_int :: proc(s: string, offset: int) -> (result: int, new_offset: int, ok: bool)Source

Parses an integer from a given string starting at a specified offset

  • s: The string to parse the integer from
  • offset: The position in the string to start parsing the integer
  • result: The parsed integer
  • new_offset: The position in the string after parsing the integer
  • ok: A boolean indicating if the parsing was successful

aprint

aprint :: proc(args, sep: untyped string = " ", allocator: mem.Allocator = context.allocator) -> (string)Source

Creates a formatted string

Allocates Using Provided Allocator

  • args: A variadic list of arguments to be formatted.
  • sep: An optional separator string (default is a single space).
  • allocator: (default: context.allocator)

aprintf

aprintf :: proc(fmt: string, args, allocator: mem.Allocator = context.allocator, newline: untyped boolean = false) -> (string)Source

Creates a formatted string using a format string and arguments

Allocates Using Provided Allocator

  • fmt: A format string with placeholders for the provided arguments.
  • args: A variadic list of arguments to be formatted.
  • allocator: (default: context.allocator)
  • newline: Whether the string should end with a newline. (See aprintfln.)

aprintfln

aprintfln :: proc(fmt: string, args, allocator: mem.Allocator = context.allocator) -> (string)Source

Creates a formatted string using a format string and arguments, followed by a newline.

Allocates Using Provided Allocator

  • fmt: A format string with placeholders for the provided arguments.
  • args: A variadic list of arguments to be formatted.
  • allocator: (default: context.allocator)

aprintln

aprintln :: proc(args, sep: untyped string = " ", allocator: mem.Allocator = context.allocator) -> (string)Source

Creates a formatted string with a newline character at the end

Allocates Using Provided Allocator

  • args: A variadic list of arguments to be formatted.
  • sep: An optional separator string (default is a single space).
  • allocator: (default: context.allocator)

assertf

assertf :: proc(condition: bool, fmt: string, args, loc = #caller_location)Source

Runtime assertion with a formatted message

  • condition: The boolean condition to be asserted
  • fmt: A format string with placeholders for the provided arguments
  • args: A variadic list of arguments to be formatted
  • loc: The location of the caller

bprint

bprint :: proc(buf: []u8, args, sep: untyped string = " ") -> (string)Source

Creates a formatted string using a supplied buffer as the backing array. Writes into the buffer.

  • buf: The backing buffer
  • args: A variadic list of arguments to be formatted
  • sep: An optional separator string (default is a single space)

bprintf

bprintf :: proc(buf: []u8, fmt: string, args, newline: untyped boolean = false) -> (string)Source

Creates a formatted string using a supplied buffer as the backing array. Writes into the buffer.

  • buf: The backing buffer
  • fmt: A format string with placeholders for the provided arguments
  • args: A variadic list of arguments to be formatted
  • newline: Whether the string should end with a newline. (See bprintfln.)

bprintfln

bprintfln :: proc(buf: []u8, fmt: string, args) -> (string)Source

Creates a formatted string using a supplied buffer as the backing array, followed by a newline. Writes into the buffer.

  • buf: The backing buffer
  • fmt: A format string with placeholders for the provided arguments
  • args: A variadic list of arguments to be formatted

bprintln

bprintln :: proc(buf: []u8, args, sep: untyped string = " ") -> (string)Source

Creates a formatted string using a supplied buffer as the backing array, appends newline. Writes into the buffer.

  • buf: The backing buffer
  • args: A variadic list of arguments to be formatted
  • sep: An optional separator string (default is a single space)

caprint

caprint :: proc(args, sep: untyped string = " ", allocator: mem.Allocator = context.allocator) -> (cstring)Source

Creates a formatted C string

Allocates Using Provided Allocator

  • args: A variadic list of arguments to be formatted.
  • sep: An optional separator string (default is a single space).
  • allocator: (default: context.allocator)

caprintf

caprintf :: proc(format: string, args, allocator: mem.Allocator = context.allocator, newline: untyped boolean = false) -> (cstring)Source

Creates a formatted C string

Allocates Using Provided Allocator

  • format: A format string with placeholders for the provided arguments
  • args: A variadic list of arguments to be formatted
  • allocator: (default: context.allocator)
  • newline: Whether the string should end with a newline. (See caprintfln.)

caprintfln

caprintfln :: proc(format: string, args, allocator: mem.Allocator = context.allocator) -> (cstring)Source

Creates a formatted C string, followed by a newline.

Allocates Using Provided Allocator

  • format: A format string with placeholders for the provided arguments
  • args: A variadic list of arguments to be formatted
  • allocator: (default: context.allocator)

ctprint

ctprint :: proc(args, sep: untyped string = " ") -> (cstring)Source

Creates a formatted C string

Allocates Using Context's Temporary Allocator

  • args: A variadic list of arguments to be formatted.
  • sep: An optional separator string (default is a single space).

ctprintf

ctprintf :: proc(format: string, args, newline: untyped boolean = false) -> (cstring)Source

Creates a formatted C string

Allocates Using Context's Temporary Allocator

  • format: A format string with placeholders for the provided arguments
  • args: A variadic list of arguments to be formatted
  • newline: Whether the string should end with a newline. (See ctprintfln.)

ctprintfln

ctprintfln :: proc(format: string, args) -> (cstring)Source

Creates a formatted C string, followed by a newline.

Allocates Using Context's Temporary Allocator

  • format: A format string with placeholders for the provided arguments
  • args: A variadic list of arguments to be formatted

ensuref

ensuref :: proc(condition: bool, fmt: string, args, loc = #caller_location)Source

Runtime ensure with a formatted message

  • condition: The boolean condition to be asserted
  • fmt: A format string with placeholders for the provided arguments
  • args: A variadic list of arguments to be formatted
  • loc: The location of the caller

eprint

eprint :: proc(args, sep: untyped string = " ", flush: untyped boolean = true) -> (int)Source

eprint formats using the default print settings and writes to os.stderr

eprintf

eprintf :: proc(fmt: string, args, flush: untyped boolean = true) -> (int)Source

eprintf formats according to the specified format string and writes to os.stderr

eprintfln

eprintfln :: proc(fmt: string, args, flush: untyped boolean = true) -> (int)Source

eprintfln formats according to the specified format string and writes to os.stderr, followed by a newline.

eprintln

eprintln :: proc(args, sep: untyped string = " ", flush: untyped boolean = true) -> (int)Source

eprintln formats using the default print settings and writes to os.stderr

fmt_arg

fmt_arg :: proc(fi: ^Info, arg: any, verb: rune)Source

Formats an argument based on its type and the given formatting verb

  • fi: A pointer to an Info struct containing formatting information.
  • arg: The value to be formatted.
  • verb: The formatting verb rune (e.g. 'T').

NOTE: Uses user formatters if available and not ignored.

fmt_array

fmt_array :: proc( fi: ^Info, data: rawptr, n: int, elem_size: int, elem: ^reflect.Type_Info, verb: rune, )Source

Formats an array into a string representation

  • fi: Pointer to the formatting Info struct.
  • data: The raw pointer to the array data.
  • n: The number of elements in the array.
  • elem_size: The size of each element in the array.
  • elem: Pointer to the type information of the array element.
  • verb: The formatting verb (e.g. 's','q','p','w').

fmt_array_nul_terminated

fmt_array_nul_terminated :: proc( fi: ^Info, data: rawptr, max_n: int, elem_size: int, elem: ^reflect.Type_Info, verb: rune, )Source

Formats a NUL-terminated array into a string representation

  • fi: Pointer to the formatting Info struct.
  • data: The raw pointer to the array data.
  • max_n: The maximum number of elements to process.
  • elem_size: The size of each element in the array.
  • elem: Pointer to the type information of the array element.
  • verb: The formatting verb.

fmt_bit_set

fmt_bit_set :: proc(fi: ^Info, v: any, name: string, verb: rune)Source

Formats a bit set and writes it to the provided Info structure

  • fi: A pointer to the Info structure where the formatted bit set will be written.
  • v: The bit set value to be formatted.
  • name: An optional string for the name of the bit set (default is an empty string).
  • verb: An optional verb to adjust format.

fmt_bool

fmt_bool :: proc(fi: ^Info, b: bool, verb: rune)Source

Formats a boolean value according to the specified format verb

  • fi: A pointer to an Info structure
  • b: The boolean value to format
  • verb: The format verb

fmt_complex

fmt_complex :: proc(fi: ^Info, c: complex128, bits: int, verb: rune)Source

Formats a complex number based on the given formatting verb

  • fi: A pointer to an Info struct containing formatting information.
  • c: The complex128 value to be formatted.
  • bits: The number of bits in the complex number (32 or 64).
  • verb: The formatting verb rune ('f', 'F', 'v', 'h', 'H', 'w').

fmt_cstring

fmt_cstring :: proc(fi: ^Info, s: cstring, verb: rune)Source

Formats a C-style string with a specific format.

  • fi: Pointer to the Info struct containing format settings.
  • s: The C-style string to format.
  • verb: The format specifier character (Ref fmt_string).

fmt_cstring16

fmt_cstring16 :: proc(fi: ^Info, s: cstring16, verb: rune)Source

Formats a C-style UTF-16 string with a specific format.

  • fi: Pointer to the Info struct containing format settings.
  • s: The C-style string to format.
  • verb: The format specifier character (Ref fmt_string).

fmt_enum

fmt_enum :: proc(fi: ^Info, v: any, verb: rune)Source

Formats an enum value with a specific format.

  • fi: Pointer to the Info struct containing format settings.
  • v: The enum value to format.
  • verb: The format specifier character (e.g. 'i','d','f','s','v','q','w').

fmt_float

fmt_float :: proc(fi: ^Info, v: f64, bit_size: int, verb: rune)Source

Formats a floating-point number with a specific format.

  • fi: Pointer to the Info struct containing format settings.
  • v: The floating-point number to format.
  • bit_size: The size of the floating-point number in bits (16, 32, or 64).
  • verb: The format specifier character.

fmt_int

fmt_int :: proc(fi: ^Info, u: u64, is_signed: bool, bit_size: int, verb: rune)Source

Formats an integer value according to the specified formatting verb.

  • fi: A pointer to the Info struct containing formatting options.
  • u: The integer value to be formatted.
  • is_signed: Whether the value should be treated as signed or unsigned.
  • bit_size: The number of bits of the value (e.g. 32, 64).
  • verb: The formatting verb to use (e.g. 'v', 'b', 'o', 'i', 'd', 'z', 'x', 'X', 'c', 'r', 'U').

fmt_int_128

fmt_int_128 :: proc(fi: ^Info, u: u128, is_signed: bool, bit_size: int, verb: rune)Source

Formats an int128 value according to the specified formatting verb.

  • fi: A pointer to the Info struct containing formatting options.
  • u: The int128 value to be formatted.
  • is_signed: Whether the value should be treated as signed or unsigned.
  • bit_size: The number of bits of the value (e.g. 64, 128).
  • verb: The formatting verb to use (e.g. 'v', 'b', 'o', 'i', 'd', 'z', 'x', 'X', 'c', 'r', 'U').

fmt_matrix

fmt_matrix :: proc(fi: ^Info, v: any, verb: rune, info: runtime.Type_Info_Matrix)Source

Formats a matrix as a string

  • fi: A pointer to an Info struct containing formatting information.
  • v: The matrix value to be formatted.
  • verb: The formatting verb rune.
  • info: A runtime.Type_Info_Matrix struct containing matrix type information.

fmt_named

fmt_named :: proc(fi: ^Info, v: any, verb: rune, info: runtime.Type_Info_Named)Source

Formats a named type into a string representation

  • fi: Pointer to the formatting Info struct.
  • v: The value to format.
  • verb: The formatting verb.
  • info: The named type information.

NOTE: This procedure supports built-in custom formatters for core library types such as runtime.Source_Code_Location, time.Duration, and time.Time.

fmt_pointer

fmt_pointer :: proc(fi: ^Info, p: rawptr, verb: rune)Source

Formats a raw pointer with a specific format.

  • fi: Pointer to the Info struct containing format settings.
  • p: The raw pointer to format.
  • verb: The format specifier character (e.g. 'p', 'v', 'b', 'o', 'i', 'd', 'z', 'x', 'X').

fmt_quaternion

fmt_quaternion :: proc(fi: ^Info, q: quaternion256, bits: int, verb: rune)Source

Formats a quaternion number based on the given formatting verb

  • fi: A pointer to an Info struct containing formatting information.
  • q: The quaternion256 value to be formatted.
  • bits: The number of bits in the quaternion number (64, 128, or 256).
  • verb: The formatting verb rune ('f', 'F', 'v', 'h', 'H', 'w').

fmt_rune

fmt_rune :: proc(fi: ^Info, r: rune, verb: rune)Source

Formats a rune value according to the specified formatting verb.

  • fi: A pointer to the Info struct containing formatting options.
  • r: The rune value to be formatted.
  • verb: The formatting verb to use (e.g. 'c', 'r', 'v', 'q').

fmt_string

fmt_string :: proc(fi: ^Info, s: string, verb: rune)Source

Formats a string with a specific format.

  • fi: Pointer to the Info struct containing format settings.
  • s: The string to format.
  • verb: The format specifier character (e.g. 's', 'v', 'q', 'x', 'X').

fmt_string16

fmt_string16 :: proc(fi: ^Info, s: string16, verb: rune)Source

Formats a string UTF-16 with a specific format.

  • fi: Pointer to the Info struct containing format settings.
  • s: The string to format.
  • verb: The format specifier character (e.g. 's', 'v', 'q', 'x', 'X').

fmt_struct

fmt_struct :: proc(fi: ^Info, v: any, the_verb: rune, info: runtime.Type_Info_Struct, type_name: string)Source

Formats a struct for output, handling various struct types (e.g., SOA, raw unions)

  • fi: A mutable pointer to an Info struct containing formatting state
  • v: The value to be formatted
  • the_verb: The formatting verb to be used (e.g. 'v')
  • info: Type information about the struct
  • type_name: The name of the type being formatted

fmt_union

fmt_union :: proc(fi: ^Info, v: any, verb: rune, info: runtime.Type_Info_Union, type_size: int)Source

Formats a union type into a string representation

  • fi: Pointer to the formatting Info struct.
  • v: The value to format.
  • verb: The formatting verb.
  • info: The union type information.
  • type_size: The size of the union type.

fmt_value

fmt_value :: proc(fi: ^Info, v: any, verb: rune)Source

Formats a value based on its type and formatting verb

  • fi: A pointer to an Info struct containing formatting information.
  • v: The value to be formatted.
  • verb: The formatting verb rune.

NOTE: Uses user formatters if available and not ignored.

fmt_write_array

fmt_write_array :: proc( fi: ^Info, array_data: rawptr, count: int, elem_size: int, elem_id: typeid, verb: rune, )Source

Formats an array and writes it to the provided Info structure

  • fi: A pointer to the Info structure where the formatted array will be written.
  • array_data: A raw pointer to the array data.
  • count: The number of elements in the array.
  • elem_size: The size of each element in the array.
  • elem_id: The typeid of the array elements.
  • verb: The formatting verb to be used for the array elements.

fprint

fprint :: proc(f: ^os.File, args, sep: untyped string = " ", flush: untyped boolean = true) -> (int)Source

NOTE(Jeroen): The other option is to deprecate fprint* and make it an alias for wprint*, using File.stream directly. fprint formats using the default print settings and writes to fd

fprintf

fprintf :: proc(f: ^os.File, fmt: string, args, flush: untyped boolean = true, newline: untyped boolean = false) -> (int)Source

fprintf formats according to the specified format string and writes to fd

fprintfln

fprintfln :: proc(f: ^os.File, fmt: string, args, flush: untyped boolean = true) -> (int)Source

fprintfln formats according to the specified format string and writes to fd, followed by a newline.

fprintln

fprintln :: proc(f: ^os.File, args, sep: untyped string = " ", flush: untyped boolean = true) -> (int)Source

fprintln formats using the default print settings and writes to fd

int_from_arg

int_from_arg :: proc(args: []any, arg_index: int) -> (bool, int, int)Source

Retrieves an integer from a list of any type at the specified index

  • args: A list of values of any type
  • arg_index: The index to retrieve the integer from
  • int: The integer value at the specified index
  • new_arg_index: The new argument index
  • ok: A boolean indicating if the conversion to integer was successful

panicf

panicf :: proc(fmt: string, args, loc = #caller_location) -> ()Source

Runtime panic with a formatted message

  • fmt: A format string with placeholders for the provided arguments
  • args: A variadic list of arguments to be formatted
  • loc: The location of the caller

print

print :: proc(args, sep: untyped string = " ", flush: untyped boolean = true) -> (int)Source

print formats using the default print settings and writes to os.stdout

printf

printf :: proc(fmt: string, args, flush: untyped boolean = true) -> (int)Source

printf formats according to the specified format string and writes to os.stdout

printfln

printfln :: proc(fmt: string, args, flush: untyped boolean = true) -> (int)Source

printfln formats according to the specified format string and writes to os.stdout, followed by a newline.

println

println :: proc(args, sep: untyped string = " ", flush: untyped boolean = true) -> (int)Source

println formats using the default print settings and writes to os.stdout

sbprint

sbprint :: proc(buf: ^strings.Builder, args, sep: untyped string = " ") -> (string)Source

Formats using the default print settings and writes to the given strings.Builder

  • buf: A pointer to a strings.Builder to store the formatted string
  • args: A variadic list of arguments to be formatted
  • sep: An optional separator string (default is a single space)

sbprintf

sbprintf :: proc(buf: ^strings.Builder, fmt: string, args, newline: untyped boolean = false) -> (string)Source

Formats and writes to a strings.Builder buffer according to the specified format string

  • buf: A pointer to a strings.Builder buffer
  • fmt: The format string
  • args: A variadic list of arguments to be formatted
  • newline: Whether a trailing newline should be written. (See sbprintfln.)

sbprintfln

sbprintfln :: proc(buf: ^strings.Builder, format: string, args) -> (string)Source

Formats and writes to a strings.Builder buffer according to the specified format string, followed by a newline.

  • buf: A pointer to a strings.Builder to store the formatted string
  • args: A variadic list of arguments to be formatted

sbprintln

sbprintln :: proc(buf: ^strings.Builder, args, sep: untyped string = " ") -> (string)Source

Formats and writes to a strings.Builder buffer using the default print settings

  • buf: A pointer to a strings.Builder buffer
  • args: A variadic list of arguments to be formatted
  • sep: An optional separator string (default is a single space)

stored_enum_value_to_string

stored_enum_value_to_string :: proc(enum_type: ^runtime.Type_Info, ev: runtime.Type_Info_Enum_Value, offset: int) -> (bool, string)Source

Converts a stored enum value to a string representation

  • enum_type: A pointer to the runtime.Type_Info of the enumeration.
  • ev: The runtime.Type_Info_Enum_Value of the stored enum value.
  • offset: An optional integer to adjust the enumeration value (default is 0).

string_to_enum_value

string_to_enum_value :: proc(T: typeid, s: string) -> (bool, T)Source

Returns the enum value of a string representation.

$T: The typeid of the enum type. Inputs:

  • s: The string representation of the enum value.

tprint

tprint :: proc(args, sep: untyped string = " ") -> (string)Source

Creates a formatted string

Allocates Using Context's Temporary Allocator

  • args: A variadic list of arguments to be formatted.
  • sep: An optional separator string (default is a single space).

tprintf

tprintf :: proc(fmt: string, args, newline: untyped boolean = false) -> (string)Source

Creates a formatted string using a format string and arguments

Allocates Using Context's Temporary Allocator

  • fmt: A format string with placeholders for the provided arguments.
  • args: A variadic list of arguments to be formatted.
  • newline: Whether the string should end with a newline. (See tprintfln.)

tprintfln

tprintfln :: proc(fmt: string, args) -> (string)Source

Creates a formatted string using a format string and arguments, followed by a newline.

Allocates Using Context's Temporary Allocator

  • fmt: A format string with placeholders for the provided arguments.
  • args: A variadic list of arguments to be formatted.

tprintln

tprintln :: proc(args, sep: untyped string = " ") -> (string)Source

Creates a formatted string with a newline character at the end

Allocates Using Context's Temporary Allocator

  • args: A variadic list of arguments to be formatted.
  • sep: An optional separator string (default is a single space).

wprint

wprint :: proc(w: io.Writer, args, sep: untyped string = " ", flush: untyped boolean = true) -> (int)Source

Formats and writes to an io.Writer using the default print settings

  • w: An io.Writer to write to
  • args: A variadic list of arguments to be formatted
  • sep: An optional separator string (default is a single space)

wprint_type

wprint_type :: proc(w: io.Writer, info: ^runtime.Type_Info, flush: untyped boolean = true) -> (io.Error, int)Source

Writes a ^runtime.Type_Info value to an io.Writer

  • w: An io.Writer to write to
  • info: A pointer to a runtime.Type_Info value

wprint_typeid

wprint_typeid :: proc(w: io.Writer, id: typeid, flush: untyped boolean = true) -> (io.Error, int)Source

Writes a typeid value to an io.Writer

  • w: An io.Writer to write to
  • id: A typeid value

wprintf

wprintf :: proc(w: io.Writer, fmt: string, args, flush: untyped boolean = true, newline: untyped boolean = false) -> (int)Source

Formats and writes to an io.Writer according to the specified format string

  • w: An io.Writer to write to
  • fmt: The format string
  • args: A variadic list of arguments to be formatted
  • newline: Whether a trailing newline should be written. (See wprintfln.)

wprintfln

wprintfln :: proc(w: io.Writer, format: string, args, flush: untyped boolean = true) -> (int)Source

Formats and writes to an io.Writer according to the specified format string, followed by a newline.

  • w: The io.Writer to write to.
  • args: A variadic list of arguments to be formatted.

wprintln

wprintln :: proc(w: io.Writer, args, sep: untyped string = " ", flush: untyped boolean = true) -> (int)Source

Formats and writes to an io.Writer using the default print settings with a newline character at the end

  • w: An io.Writer to write to
  • args: A variadic list of arguments to be formatted
  • sep: An optional separator string (default is a single space)

Reference search

Find anything

Documentation preferences

Settings

System theme variants

Used only while Theme is set to System.