controllogic: make expr evaluator value-polymorphic (arrays, indexing, array funcs)

Rewrites internal/controllogic/expr.go to evaluate to Value (scalar float64
or []Value array): adds array literals [a,b], postfix indexing arr[i], and
array functions (len, sum, mean, push, pop, slice, concat, sort, …). Resolver
type changes from func(...) float64 to func(...) Value; EvalValue added;
EvalExpr/EvalBool retain scalar float64/bool returns. Three temporary shims
added in engine.go, lua.go, and expr_test.go pending Tasks 4 and 6.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Martino Ferrari
2026-06-24 14:53:40 +02:00
parent 3ddffc14d7
commit 519c1f2df4
4 changed files with 446 additions and 66 deletions
+1 -1
View File
@@ -897,7 +897,7 @@ func (cg *compiledGraph) activate(triggerID string) {
dt = float64(now-last) / 1e9
}
resolve := func(ds, name string) float64 {
resolve := func(ds, name string) Value { // shim: was float64 (Task 4 removes)
switch ds {
case "sys":
if name == "dt" {