diff options
| author | s-ol <s-ol@users.noreply.github.com> | 2020-07-11 17:25:50 +0000 |
|---|---|---|
| committer | s-ol <s+removethis@s-ol.nu> | 2025-03-02 14:24:49 +0000 |
| commit | 936c7106f93de650bf985984b76e03b9ea0d328e (patch) | |
| tree | a5faee11c746c5d93e46ebf9a6e8a97aac2cd62b /alv/base | |
| parent | rename time/sequence to time/val-seq and add time/bang-seq (diff) | |
| download | alive-936c7106f93de650bf985984b76e03b9ea0d328e.tar.gz alive-936c7106f93de650bf985984b76e03b9ea0d328e.zip | |
add vis field to Ops
Diffstat (limited to 'alv/base')
| -rw-r--r-- | alv/base/op.moon | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/alv/base/op.moon b/alv/base/op.moon index b152543..625e1a8 100644 --- a/alv/base/op.moon +++ b/alv/base/op.moon @@ -22,7 +22,8 @@ class Op fork: => out = if @out then @out\fork! state = if @state then deep_copy @state - @@ out, state + vis = if @vis then deep_copy @vis + @@ out, state, vis --- internal state of this Op. -- @@ -31,6 +32,16 @@ class Op -- -- @tfield table state + --- visualisation data of this Op. + -- + -- This may be any simple Lua value, including Lua tables, as long as it has + -- no metatables, multiple references/loops, userdata etc. + -- + -- This value is exposed to alv editors in order to render realtime + -- visualisations overlaid onto the program text. + -- + -- @tfield table vis + --- `Result` instance representing this Op's computed output value. -- -- Must be set to a `Result` instance once `setup` finishes. Must not change @@ -107,7 +118,8 @@ class Op -- @classmethod -- @tparam ?Result out `out` -- @tparam ?table state `state` - new: (@out, @state) => + -- @tparam ?table vis `vis` + new: (@out, @state, @vis={}) => do_setup = (old, cur) -> for k, cur_val in pairs cur |
