lua/lua ? reverse-engineered prompt
Reverse engineered prompt
Build me a clean C implementation of the Lua language, aimed at being small, fast, and easy to embed in other programs.
I want a command line interpreter that can run script files and also work as a simple interactive prompt. It should support the core language, compile source to bytecode for execution, and include the usual standard libraries people expect, like strings, tables, math, file and OS access, coroutines, utf8, and debugging. Please also expose a simple C API so another app can create a Lua state, load code, call functions, and register native C functions.
Make it portable and straightforward to build on a normal machine, and include the manual and tests so it is easy to verify that everything works. Keep the codebase tidy and close to how Lua normally behaves, rather than reinventing the language. If you need details, look up the current Lua docs online and match the standard behavior as closely as possible.
Are you gonna build this?
make sure you review the code using coderabbit