Skip to content

This site describes solve-engine as it is on main: 2.43.0, which npm does not have yet. npm installs 2.40.0, so a page may show an answer that version does not give yet.

allocatePluginFunctionIndex

function allocatePluginFunctionIndex(): number;

Defined in: packages/engine/src/vm/VMBuiltins.ts:2326

Allocate a unique index into pluginFunctionRegistry for a package’s plugin function.

Call once per function, typically at module scope, right where the function is defined, and store the result in a constant. Don’t hardcode an index: two packages independently picking the same arbitrary number would silently overwrite each other’s handler in the shared registry.

number

If the index pool is exhausted (up to 65536: two opcode-stream bytes via CALL_PLUGIN_WIDE, the first 256 via the one-byte CALL_PLUGIN).