Fixing sequence no longer working with current rendering method.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Adsooi 2024-03-25 18:58:07 +01:00
parent f730121047
commit a6fcf6da19
Signed by: Ad5001
GPG key ID: EF45F9C6AFE20160

View file

@ -65,11 +65,15 @@ class Sequence extends Expr.Expression {
cache(n = 1) {
var str = Utils.simplifyExpression(this.calc.substitute('n', n-this.valuePlus).toString())
var expr = C.parser.parse(str).simplify()
// Chache values required for this one.
if(!this.calcValues[n-this.valuePlus] && n-this.valuePlus > 0)
this.cache(n-this.valuePlus)
// Setting current variables
C.currentVars = Object.assign(
{'n': n-this.valuePlus}, // Just in case, add n (for custom functions)
C.currentObjectsByName
C.currentObjectsByName,
{[this.name]: this.calcValues}
)
C.currentVars[this.name] = this.calcValues
this.calcValues[n] = expr.evaluate(C.currentVars)
}