[ANN] A rust base Lua 5.4 implement

106 views
Skip to first unread message

CppCXY

unread,
Nov 23, 2025, 10:52:59 PM (4 days ago) Nov 23
to lua-l
The project is still in a toy/prototype stage and is not yet usable. If you’re interested, feel free to take a look and help optimize the implementation. see:  CppCXY/lua-rs: lua runtime implement in rust

The Future of Programming

unread,
Nov 23, 2025, 11:38:00 PM (4 days ago) Nov 23
to lua-l
Hello

Thanks for sharing :D

I see that the first commit was made just two weeks ago. Was all of this completed within that short time frame?
Do you think a similar effort could be achieved for the Ring programming language (Written in ANSI C, 25 KLOC) in roughly the same amount of time?
What real benefits have you discovered from using Rust to implement Lua?
Do you feel more productive with a Rust implementation compared to C?
Are performance measurements includes using optimizations when building the C version of Lua (Sharing C Compiler version, optimization flags, OS, etc. is important)? 

Greetings,
Mahmoud

CppCXY

unread,
Nov 24, 2025, 12:42:59 AM (4 days ago) Nov 24
to lua-l
 The test conclusions are unreliable — I discovered that I had compiled the Lua interpreter as a debug build.

The Future of Programming

unread,
Nov 24, 2025, 1:02:45 AM (4 days ago) Nov 24
to lua-l
Hello

>> "The test conclusions are unreliable — I discovered that I had compiled the Lua interpreter as a debug build."

Thanks for sharing this

Greetings,
Mahmoud

CppCXY

unread,
Nov 24, 2025, 1:24:09 AM (4 days ago) Nov 24
to lua-l
1. Actually the first version was finished in three days, but its performance was very poor. After a week of refactoring it barely reached the current performance. The reason it was written so quickly is that most of the code was produced by AI.
2. I think if Ring were also implemented with AI, an initial version could be completed within about a week.
3. The benefit of implementing Lua in Rust is that it enables test-driven development — you can write and test as you go.
4. Compared to C, implementing Lua semantics in Rust is more difficult, and performance is hard to match the C implementation. Modern C implementations are highly optimized; Rust code has many bounds checks, and even using unsafe it is hard to close the gap. On the other hand, Rust allows native use of its ecosystem libraries and can be compiled directly to the wasm-unknown-unknown target, which is an advantage.
5. The previous performance test results were wrong; I have corrected them in the README. The test platform was Windows, built with MSVC using a CMake script I wrote.

The Future of Programming

unread,
Nov 24, 2025, 2:13:12 AM (4 days ago) Nov 24
to lua-l
Hello

>> "Actually the first version was finished in three days, but its performance was very poor. After a week of refactoring it barely reached the current performance. The reason it was written so quickly is that most of the code was produced by AI"

This is very nice :D

Greetings,
Mahmoud

Reply all
Reply to author
Forward
0 new messages