Skip to content

Lua

Lua is Rival’s fastest-starting language for Function tools — ideal for lightweight logic with minimal dependencies. The runtime is a strict sandbox: file I/O, module imports, and dynamic code execution are disabled.

Define a global cortexone_handler in cortexone_function.lua, accepting event and context and returning a table with statusCode and body.

  • A pre-loaded json module for encoding/decoding.
  • os.time() for Unix timestamps.
  • Standard Lua libraries: string, table, math.
  • Environment variables via process.env for secrets.
  • Conditional HTTP through fetch(), which returns a structured response table (not a string).

File I/O, module imports, dynamic code execution, and most OS access are disabled — specifically the io module, require(), package, dynamic loaders, and most os functions.

512 MB memory, 300-second runtime, 2.0-core CPU. Runtime failures are automatically wrapped with a 500 status code.