class ValueStream
Continuous stream of values.
Implements the Stream and AST intefaces.
index
members
-
valuestream:dirty()
– return whether this stream was changed in the current tick. -
valuestream:set(value)
– update this stream’s value. -
valuestream:unwrap([type[, msg]])
– unwrap to the Lua type. -
valuestream:fork()
– create a mutable copy of this stream. -
valuestream:__call(...)
– alias for unwrap. -
valuestream:__eq(other)
– compare two values. -
valuestream.metatype()
– Stream metatype. -
valuestream.value
– the wrapped Lua value. -
valuestream.meta
– documentation metadata.
static functions
-
ValueStream(type, value, raw)
– construct a new ValueStream. -
ValueStream:parse(type, sep)
– create a capture-function (for parsing with Lpeg). -
ValueStream.wrap(val[, name])
– wrap a Lua value. -
ValueStream.num(num)
– create a constant number. -
ValueStream.str(str)
– create a constant string. -
ValueStream.sym(sym)
– create a constant symbol. -
ValueStream.bool(bool)
– create a constant boolean. -
ValueStream.meta(args)
– wrap and document a value.
ast interface
-
valuestream:eval(scope)
– evaluate this literal constant. -
valuestream:stringify()
– stringify this literal constant. -
valuestream:clone(prefix)
– clone this literal constant.
details
members
-
– return whether this stream was changed in the current tick.
returns:
- (bool)
-
– update this stream’s value.
Marks this stream as dirty for the remainder of the current tick.
parameters:
- – unwrap to the Lua type.
-
– create a mutable copy of this stream.
Used to insulate eval-cycles from each other.
returns:
-
– alias for unwrap.
parameters:
- – compare two values.
-
– Stream metatype.
-
– the wrapped Lua value.
-
– documentation metadata.
an optional table containing metadata for error messages and documentation. The following keys are recognized:
name
: optional namesummary
: single-line description (markdown)examples
: optional list of single-line code examplesdescription
: optional full-text description (markdown)
static functions
- – construct a new ValueStream.
- – create a capture-function (for parsing with Lpeg).
-
– wrap a Lua value.
Attempts to guess the type and wrap a Lua value.
parameters:
- the value to wrap
- the name of this value (for error logging) (optional)
returns:
- – create a constant number.
- – create a constant string.
- – create a constant symbol.
- – create a constant boolean.
- – wrap and document a value.
ast interface
- – evaluate this literal constant.
- – stringify this literal constant.
- – clone this literal constant.