The luau Plugin loads a Script Headless (#75) #79

Closed
opened 2026-09-06 01:24:05 +00:00 by crowmaki · 0 comments
Owner

Parent

#75

What to build

A luau Plugin that stands up Headless, hosts one Luau VM, and runs a Script handed to it as bytes. The Plugin publishes cinnabar.script/1 with load(self, name, source: Byte_Span) -> bool and unload(self, name) -> bool, requires no other Interface, and works with no Backend and no Platform. The VM is created in register and closed in shutdown. A Script is one chunk compiled and run in a fresh environment table so two Scripts do not share globals. print and warn are rebound to the engine logger at info and warning levels.

Every entry into the VM goes through pcall; a failure logs the message and traceback under the Plugin's logger and the call returns. A Script that fails to compile, or fails while running its chunk, is rejected and load returns false. Every Luau C callback is a proc "c" that establishes context from the Engine pointer it recovers from the VM before calling Odin (ADR-0008) and raises errors only as its last statement (ADR-0015).

Acceptance criteria

  • An Engine built from only the luau Plugin initialises, ticks, and shuts down with no Backend and no Platform
  • load with a Script whose chunk calls print produces an info log line; warn produces a warning
  • Two Scripts loaded under different names do not see each other's globals
  • load with a Script that fails to compile returns false and logs the compiler message
  • load with a Script whose chunk raises at runtime returns false and logs the message with a Luau traceback
  • unload of a loaded name returns true; of an unknown name returns false
  • The Plugin package is in the justfile packages list and the suite in tests/luau drives it with Luau source strings only

Blocked by

## Parent #75 ## What to build A `luau` Plugin that stands up Headless, hosts one Luau VM, and runs a Script handed to it as bytes. The Plugin publishes `cinnabar.script/1` with `load(self, name, source: Byte_Span) -> bool` and `unload(self, name) -> bool`, requires no other Interface, and works with no Backend and no Platform. The VM is created in `register` and closed in `shutdown`. A Script is one chunk compiled and run in a fresh environment table so two Scripts do not share globals. `print` and `warn` are rebound to the engine logger at info and warning levels. Every entry into the VM goes through `pcall`; a failure logs the message and traceback under the Plugin's logger and the call returns. A Script that fails to compile, or fails while running its chunk, is rejected and `load` returns false. Every Luau C callback is a `proc "c"` that establishes `context` from the Engine pointer it recovers from the VM before calling Odin (ADR-0008) and raises errors only as its last statement (ADR-0015). ## Acceptance criteria - [ ] An Engine built from only the `luau` Plugin initialises, ticks, and shuts down with no Backend and no Platform - [ ] `load` with a Script whose chunk calls `print` produces an info log line; `warn` produces a warning - [ ] Two Scripts loaded under different names do not see each other's globals - [ ] `load` with a Script that fails to compile returns false and logs the compiler message - [ ] `load` with a Script whose chunk raises at runtime returns false and logs the message with a Luau traceback - [ ] `unload` of a loaded name returns true; of an unknown name returns false - [ ] The Plugin package is in the justfile `packages` list and the suite in `tests/luau` drives it with Luau source strings only ## Blocked by - #78
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
crowmaki/cinnabar#79
No description provided.