Home › Cookbook
Choosing an Entrypoint
Pick the narrowest Ouro entrypoint that matches your trust boundary and performance goal.
Decision Guide Inside Ouro
| Need | Use | Notes |
|---|---|---|
| Run one untrusted script safely | Ouro.run | Defaults to "balanced" preset, mode = "text" for strings, returns (ok, ...resultsOrErr). |
| Run many scripts under a shared policy | Ouro.sandbox | Define globals, libraries, and budgets once; call :fork() per user and :reset() between ticks. |
| Maximum warm VM speed on trusted code | Ouro.load / VM.loadBytecode | Runs on the unguarded @native dispatch loop with zero wrapper overhead; isolated env by default. |
| Skip parser & compiler completely at runtime | VM.loadBytecode / VM.loadProto | Only loads Ouro.VM; works well for server-compiled scripts and plugin bytecode. |
| Compile source or AST for storage or inspection | Ouro.compile / Ouro.compileResult | compile returns (bytecode?, err?); compileResult returns structured diagnostics and BytecodeBuilder. |
| Parse, lint, format diagnostics, or rewrite source | Ouro.parse | Flat numeric arena; :text(), :formatDiagnostics(), lossless = true + :reconstruct(). |
| Verify or inspect bytecode without running it | Ouro.Bytecode | verify, deserialize, serialize, disassemble all return uniform (value?, err?) tuples. |
Ouro vs Alternatives
Each runtime makes a different engineering trade-off:
| Tool | Runs on Roblox Client? | Built-in Compiler? | Sandbox Limits (insn / timeout / memory / pattern)? | Warm Execution Speed |
|---|---|---|---|---|
Roblox loadstring | Server only (disabled by default; requires ServerScriptService.LoadStringEnabled) | Native C++ Luau | None (runs directly in engine; infinite loops or memory bombs hit script timeout / server OOM) | Native C++ engine (fastest) |
| Ouro | Server and client (pure Luau) | Full Luau 0.748 O0–O2 + lossless AST + verifier | Built-in presets (strict / balanced / trusted), per-env PCG32 RNG, non-swallowable budgets, step-budgeted patterns | Dual @native fast & guarded loops |
| Fiu | Server and client (pure Luau) | No (requires external bytecode compiler) | Manual hook/env wiring | Pure-Luau interpreter |
| LuauCeption | Server and client (WASM compiled to Luau) | Embedded C++ Luau 0.654 via WASM | Manual C API wiring (lua_State); pcall unwinding throws in WASM C++ exceptions | Emscripten WASM VM in Luau |
When Not to Use Ouro
- Trusted server-only code where native speed is required: If you control the code and don't need sandboxing, deploy normal Luau
ModuleScripts instead of an embedded VM. - Full static type checking: Ouro parses all Luau
0.748type annotations and.d.luaudeclarations, and emits compilertypeinfo, but does not include Luau's type checker (Luau.Analysis). - Experimental
v100class execution: Ouro parses, compiles, and decodes experimental class syntax/bytecode (v100), while the VM rejectsv100execution until upstream stabilizes class runtime semantics.