What do I think about Lua after shipping a project with 60k lines of code?
Lua in Large Codebases
- Multiple commenters confirm that tens of thousands of lines of Lua is workable, but requires discipline, tests, and often extra tooling (type checkers, linters).
- Pain points from long-term maintenance include:
- Functions quietly accepting wrong numbers of arguments, leading to subtle bugs when signatures change.
- Tables acting as both arrays and dictionaries, especially when deletions create “holes” and iteration misses elements.
- 1-based indexing and off-by-one errors in algorithms and C interop.
- Some feel Lua could really benefit from a statically typed layer compiling to Lua (Teal, Luau and similar projects are mentioned as steps in that direction).
Dynamic vs Static Typing
- Several argue that you can’t judge a dynamic language until you’ve maintained a large, old codebase in it; enthusiasm often drops when refactoring years later.
- Stories from Lua, PHP, Python, and Ruby codebases describe:
- Fear of refactoring due to lack of type guarantees.
- A tendency to “bolt on hacks” instead of cleaning up, creating a self-reinforcing mess.
- Many express a strong preference for static types (Rust, Go, Java, C#, TypeScript) during maintenance, seeing the typechecker as “compile-time unit tests” and a refactoring guide.
Type Systems: TypeScript, Python, Go, Rust
- Debate over how “static” TypeScript really is:
- One side emphasizes that
tscrejects ill-typed programs and supports advanced analysis. - Others point out its unsoundness and ease of “lying” with casts, comparing this to Python’s optional type hints.
- One side emphasizes that
- Python with mypy/ruff is seen as better than raw dynamic Python but still weaker than a mandatory, sound static type system.
- Rust’s type system is praised for enabling large refactors by following compile errors, and for allowing many invariants to be encoded in types, reducing the need for some tests.
Lua, Games, and Engines
- Lua is reaffirmed as a traditional game scripting language; many games and engines (Defold, LÖVE, Roblox/Luau, etc.) use it or variants.
- One thread contrasts using the classic Lua C API vs LuaJIT FFI, arguing that the latter (or similar FFI layers) keeps development on a more pleasant “happy path.”
- Some emphasize that for game scripting, engine performance dominates and a slower or dynamic scripting layer is often fine.
Lines of Code and Article Reception
- LoC is seen not as a value judgment but as a rough scale indicator; more LoC generally means harder maintenance.
- Some readers wanted deeper architectural reflection from the article and questioned the author’s depth of experience, while others defended that practical, imperfect experience is still valuable.