4x8matrix/silk

Silk - Luau in Luau

Yanked

Silk

Run Luau inside Luau. The real interpreter and standard library, compiled to WebAssembly and transpiled to Luau, wrapped in a typed API with hooks to observe and steer execution.

Install

pesde add 4x8matrix/silk

Quickstart

local Silk = require("./luau_packages/silk")

local vm = Silk.new()
print(vm:run("return 6 * 7")) -- 42

vm:setGlobal("greeting", "hi")
print(vm:getGlobal("greeting")) -- hi

The marshalling boundary

vm:push / vm:pull move only basic values: nil, boolean, number, string. Everything else (tables, functions, userdata) is yours to build on the stack through the raw C-API on vm.exports. This is deliberate — a VM-embedding library shouldn't pretend to marshal reference values it can't honestly own.

Tools

Each tool attaches to a VM and shares one cached state per VM:

local hook = Silk.hook.attach(vm)
toolwhat
controlthrottle / stop / watchdog (kill runaway loops)
traceinstruction stepping
asyncthread primitives (resume / yield / move)
hookrobust function hooking (globals + upvalue captures)
interceptcall interception
closure / proto / memoryupvalues, proto constants, raw memory
gcwalk live objects by type
envsandboxed environments

Build

scripts/setup.sh   # fetch the pinned Luau submodule, apply patches, ensure spider-cli
scripts/build.sh   # Luau -> wasm (emscripten) -> Luau (Spider) -> src/generated/vm.luau