LuaMindContextExtension

@FunctionalInterface()
public interface LuaMindContextExtension

Adds a host's own fields to the context table each Lua Mind callback receives. Pass a separate extension per instantiate call when it carries per-entity state.

extend runs on the server thread inside the callback's execution budget: its CPU time counts toward the program's runaway cpu_micros limit, and an exception it throws fails that callback. The built-in fields (tick, generation, entity, memory, perception, actuator and actions) are reserved and must not be overwritten. Reading a built-in from extend forces its lazy snapshot.

Add fields with rawset, the cheapest way, or with lazyField, which keeps the built-in sections readable. Do not replace the table's metatable or its __index: the built-in sections are read through them.

Functions

Link copied to clipboard
public abstract void extend(LuaTable table, MindContext context, String contribution)