Documentation
¶
Overview ¶
Package script runs Go scripts inside silk at runtime (via a yaegi interpreter) with the tag API pre-bound, so designer-authored logic — derived tags, alarm actions, button handlers — can be edited and run without recompiling the app.
The exposed surface is deliberately small and safe: the "silk" package (tag read/write + log) plus a curated subset of the standard library (fmt, math, strings, strconv, time). Filesystem, network and process packages are NOT exposed, so a screen script cannot reach outside the process.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine runs scripts against a tag database.
func NewEngine ¶
NewEngine builds an engine whose scripts drive the given tag database. The "silk" package is pre-imported, so a script body can call silk.SetTag/GetTag directly; scripts may additionally import the whitelisted stdlib packages.
func (*Engine) Eval ¶
Eval evaluates src and returns the value of its final expression (nil when the script yields no value).
func (*Engine) RunOnTagChange ¶
func (e *Engine) RunOnTagChange(tagName, src string) core.CancelFunc
RunOnTagChange runs src every time the named tag changes, so a script can react to live data (compute a derived tag, raise an alarm). The returned func unsubscribes and is idempotent.