Custom parsii functions
dfsek opened this issue ยท 2 comments
Add a way to register custom Parsii functions in the pack manifest, probably under a functions
key analogous to variables.
Functions would have a customizable number of arguments, represented as alphabetic variables within a parsii equation, e.g. 3 arguments = a
b
and c
as vars within the equation.
Mockup:
functions:
fourMax:
arguments: 4
function: "max(max(max(a, b), c), d)"
These would be parsed per-biome, and registered separately to each biome's Expression instances, to allow them to
- Use overridden variables in biomes
- Be overridden in biomes.
Maybe also optionally add a way to give argument variables custom names, e.g.
functions:
fourMax:
arguments: 4
variable-names:
- w
- x
- y
- z
function: "max(max(max(w, x), y), z)"
Any indices not present in the names list would just be assigned alphabetic names.
Implemented in 1863ba2