Skip to content

sonolus.script.values

alloc(type_: type[T]) -> T

Return an uninitialized instance of the given type.

Use this carefully as reading from uninitialized memory can lead to unexpected behavior.

copy(value: T) -> T

Make a deep copy of the given value.

Generally works the same as the unary + operator on records and arrays.

sizeof(type_: type) -> int

Return the size of the given type.

swap(a: T, b: T)

Swap the values of the two provided mutable values.

zeros(type_: type[T]) -> T

Make a new instance of the given type initialized with zeros.

Generally works the same as the unary + operator on record and array types.