Skip to content

API reference / @jsprismarine/script-host / values / ValueWriter

Class: ValueWriter ​

Defined in: script-host/src/values.ts:86

Writes values into a transfer buffer from its start.

Constructors ​

Constructor ​

new ValueWriter(buffer): ValueWriter

Defined in: script-host/src/values.ts:91

Parameters ​

buffer ​

TransferBuffer

Returns ​

ValueWriter

Properties ​

length ​

length: number = 0

Defined in: script-host/src/values.ts:88

How many bytes the writer has written.

Methods ​

list() ​

list(values): this

Defined in: script-host/src/values.ts:96

Writes a list: its count, then each value.

Parameters ​

values ​

readonly ScriptValue[]

Returns ​

this


string() ​

string(text): this

Defined in: script-host/src/values.ts:131

Writes one string value.

Parameters ​

text ​

string

Returns ​

this


value() ​

value(value): this

Defined in: script-host/src/values.ts:108

Writes one value.

Parameters ​

value ​

ScriptValue

Returns ​

this

Throws ​

For a bigint, a symbol, a function or a host object, which have no byte form.