Hey all,
I’m learning Lua and come from a Java background, and have been diving deep into Lua “classes”.
Realizing that a Lua “class” is just some clever syntactic sugar, and lacks encapsulation, I’ve found that closures can act like a Java class and protect it’s state. An added bonus is my muscle memory won’t struggle with : vs . for function calls, a pitfall I’ve already wasted time debugging.
I’m new to all this though, is there anything I’m missing? Is a Lua “class” with self and : a better choice than using a closure like a class?
You must log in or register to comment.