davidm/lua2c ? reverse-engineered prompt
Reverse engineered prompt
Build me a Lua 5.1 to C source translator that takes a Lua file and prints out equivalent C code using the Lua C API. I want it to work from the command line with a simple script, and ideally there should also be a helper command that can compile and run the generated code in one step.
It should handle a large useful subset of Lua, including normal functions, tables, loops, locals, closures, and upvalues, and it should be able to compile its own source as a test. Keep it self contained so it runs from the repo without needing a separate install step. If there are Lua features that are hard to support, like coroutines or other edge cases, leave clear notes or graceful limitations instead of pretending they work.
Please make the README level usage easy, include a couple of example Lua files, and if you need current docs for Lua 5.1 C API details, look them up online.
Are you gonna build this?
make sure you review the code using coderabbit