Expand description
Lua scripting runtime for the script plugin, built on mlua’s Luau VM.
Marshals the gateway Context into a Lua table, calls the script’s
global execute(ctx) function, and marshals the returned table back into
a Context. Also installs a sandboxed require restricted to a
configured modules directory.
Structs§
- LuaRuntime
- Holds a validated Lua script and executes it against a
Context.
Functions§
- context_
to_ 🔒lua - Marshals a
Contextinto a Lua table withrequest,response, andmessagesub-tables. Header and query-param values become 1-indexed arrays of strings; bodies become Lua strings;messagevalues are converted from JSON.errorsis not exposed to scripts. - json_
to_ 🔒lua - Converts a JSON value to the corresponding Lua value (arrays become 1-indexed tables, objects become string-keyed tables).
- lua_
to_ 🔒context - Rebuilds a
Contextfrom the table returned by the script’sexecute. - lua_
to_ 🔒json - Converts a Lua value back to JSON. Tables with a non-zero sequence length become JSON arrays, other tables become objects with string keys; unconvertible values (functions, userdata, non-UTF-8 strings) degrade to null or empty strings rather than erroring.
- setup_
module_ 🔒loader - Registers a custom
require()loader that reads.luafiles from the modules directory.