Builtin Library
README.md
procgen.modify
Edits the structure of a graph's code without hand-editing its text. edits
is a list of tables, each with an op; they apply in order and are written
together, once the graph builds with all of them.
{ op = "set", call, input, value }/{ op = "unset", call, input }: what a call is given (asprocgen.patch).{ op = "add", node, as?, args?, after? }: a new calllocal <as> = g.<node>(<args>), after the call or lineafter, else after the last statement before the outputs.{ op = "remove", call }: a call nothing after it reads.{ op = "repoint", call, node }: the call names another node and keeps what it is given.{ op = "rename", from, to }: a local, everywhere the body names it.{ op = "output", name, value }: declares or rewires an output (remove = truedrops it).{ op = "input", name, default?, type?, min?, max?, options?, description?, optional? }: declares an input, or changes the declaration of one.
A call is named by the local it declares or by a line it spans. A value is a
plain value, or { expr = "<code>" } for code; an output's value may also be
a local's name as a string. An edit that cannot apply is refused naming which
edit and why, and nothing is written.
Part of procgen.toolbox, called as tools.use("procgen", "modify", ...) (zero procgen modify in the engine shell). Returns { applied, source, diagnostics }.