mwg API
    Preparing search index...

    Class LuaAI

    Optional Lua provider with the same decision shape as JavaScriptAI.

    A Lua function receives (perception, state) and returns either an action table or { action = action_table, state = state_table, events = {...} }. The host is supplied so games can choose their own VM policy and tests can inject a fake without loading Pyroeis.

    import { LuaAI } from '@datamoc/mwg/ai/lua';

    const ai = new LuaAI({ seed: 7 });
    ai.register({ id: 'guard', source: 'return { type = "wait" }' });
    console.log(ai.decide('guard', { perception: null }).action?.type); // 'wait'
    Index