I love Lua, using it for more and more projects as the primary (not embedded) language. My current project is approaching 10,000 lines and will probably end at about 15,000 lines. What have you found useful when developing in Lua at that scale? What have you bumped your head against, and what solutions have you found? I'm thinking about development tools, language features & techniques, third-party modules?
My top 3:
strict.lua - I use a modified version of this. Without being alerted to accesses of unused/unintended variables I'd go crazy.
coroutines - not for their multithreading capability, but for their continuability. Very useful for simplifying the implementation of state machines.
serialization function - indispensable for dumping table contents, and for persisting tables to disk (I use this many times when otherwise I'd probably have reached for a database).
My Wishlist:
Visual debugger for OS X. I'm using print()s now, but a debugger that would let me single-step through source files would be great.
A continue statement. Using the repeat...until true workaround is ugly, and too many nested ifs becomes complex and ugly.
A metamethod that's invoked when an existing table member is modified.
Any other tips for larger-scale Lua development?
A continue statement. Using the repeat...until true workaround is ugly, and too many nested ifs becomes complex and ugly.
Have your loop body be a function call; then return
becomes continue
.
A metamethod that's invoked when an existing table member is modified.
You can implement this yourself by using a proxy table B that stores all of the actual data for table A - the newindex/index metamethods on A intercept writes/reads and modify/lookup from table B instead. Since A never gets anything written to it, all writes hit newindex.
Based on your top3 and wish lists, here are the products I worked on and can recommend (at least based on the feedback I received):
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With