Compiles a string of Luau source and returns it as a callable function, elevated to run with Athena’s identity. On a compile error it returns nil and the error message as a second value, matching standard loadstring behavior. Bytecode input is rejected; pass source, not compiled chunks.

Parameters

string
required
The Luau source to compile.
string
An optional name for the chunk, used in errors and tracebacks.

Returns

function or nil
The compiled function, or nil with an error string.

Example

Errors

  • decompile: the reverse: bytecode back to source.