hugomg/lua-aot-5.4 ? reverse-engineered prompt

Reverse engineered prompt

Build me a Lua 5.4 based tool that can take a Lua module and turn it into equivalent C code ahead of time.

I want it to work like a modified Lua interpreter plus a small compiler called luaot, so I can run something like luaot myscript.lua -o out.c, compile that C file into a shared library, and then load it back from Lua with require. The generated code should keep the Lua behavior the same, but run faster by removing bytecode interpretation overhead, using direct C gotos for jumps, and letting the C compiler do its normal optimizations.

Please make it easy to build from source with the usual Lua style build process, and include clear instructions for compiling both as a module and as a standalone executable when needed. If you need to check any current build details or Lua 5.4 docs while implementing it, look them up online.

Are you gonna build this?

make sure you review the code using coderabbit

Try freeSponsored — opens CodeRabbit in a new tab