Log inGet started

luau_codegen

The luau_codegen namespace — the engine's Luau API reference for luau_codegen.

The luau_codegen namespace — 3 functions.

luau_codegen/chunk

luau_codegen.chunk(name) -> table?

What one loaded chunk got, by the name it was loaded under (a module's require path, script for an execute chunk). native says whether it runs generated code; sharedCode says the code was already in the process from an earlier load of the same bytecode, in which case this load generated nothing and its byte counts are zero. result and reason say what the generator did with it. A chunk can carry native code and still report functionsRefused above zero — those functions run on the interpreter, and refusalReason names why. Returns nil for a chunk this VM never loaded, or one whose record has aged out.

Parameters

  • name string — Chunk name, with or without a leading '='

Returns table? — The chunk's record, or nil if it was never loaded

luau_codegen/chunks

luau_codegen.chunks(onlyNative?) -> {table}

Every chunk this VM loaded and what the code generator did with each, sorted by chunk name. Pass true to list only the chunks running native code. Each entry has the shape luau_codegen.chunk returns.

Parameters

  • onlyNative boolean? — List only chunks running native code

Returns {table} — Chunk records, sorted by name

luau_codegen/status

luau_codegen.status() -> table

What Luau's native code generator is doing in this engine. Every chunk the engine loads is compiled to machine code, so active is true wherever a code generator exists; state and reason say which of the ways it is absent applies when it does not — this target has no code generator, or this CPU lacks what it needs. nativeExecution is whether the VM currently dispatches to generated code. The counters cover every chunk loaded this session: chunksNative runs generated code, chunksShared are the ones of those whose code the process already had from an earlier load of the same bytecode, chunksRefused are the ones the generator produced no code for, and chunksWithoutGenerator are the ones loaded where there is none.

Returns table — {active, state, reason, nativeExecution, chunksSeen, chunksNative, chunksShared, chunksRefused, chunksWithoutGenerator, functionsCompiled, nativeCodeBytes, nativeDataBytes}

  • api
  • reference