News for hackers. Stuff that matters.
Re:The Power of Lua and Mixins by kephra on Sunday April 06, 2014 @09:07AM (#7540797)
It would be better if this article had been using real Lua code, and not starting with a "class" function. Lua does !NOT! have classes. Lua is a prototyping language, and anybody can handwave an own class system, or go without classes at all. The idea of mixins makes only sense in languages that have classes. Lua does not. References have a metatable, and this metatable contains functions. The functions are independent of the reference, and there are no classes. So basically all functions in a metatable are mixins by default.
Re:The Power of Lua and Mixins by kzrdude on Sunday April 06, 2014 @12:30PM (#7541457)
This is a boring view! All the same concepts of classes, interfaces, objects still exist when using Lua, you just don't have a canonical implementation. This is also interesting in itself -- the best class system may spread and be improved.
Re:The Power of Lua and Mixins by otikik on Sunday April 06, 2014 @12:50PM (#7541512)
Hi,

I am the author of the library mentioned in the article (not the article author, that's someone else). You seem to have missed the link to the OOP library used, so here it is:

https://github.com/kikito/middleclass

Also, notice that in other comments on this thread I mention that I don't think OOP in Lua it's a one-size-fits-all thing. I think middleclass has its uses, but most of the time plain Lua with some metatables does the trick just fine.

Re:The Power of Lua and Mixins by bartbes on Sunday April 06, 2014 @09:30AM (#7540857)
Yet the very first sentence of the article mentions the class library he's using for the rest of the it.
Re:The Power of Lua and Mixins by octopus on Sunday April 06, 2014 @11:40AM (#7541290)
Best Lua "class" example I've seen is in the PIL 3rd edition it is about 10 lines of code and lets you use inheritance and some other nice OOP concepts.