   Does Lua support Object-Oriented programming?
  I am wondering if Lua have internal support for OO programming?   
  What do you mean by internal? It has associative lists, which can be used to simulate it (it would probably be more like prototype-based OO than class-based OO though).   ;  Lua support for classes is closer to Python--offering features which can be used for OOP, including a bit of OOP-specific syntactic sugar--than it is to a language such as C++ or SmallTalk which embeds OOP at the lowest levels of syntax.   ;  Just like long ago that people use C to write OO programs?Then does it means that it would be a hard work to use OOP with Lua?   ;  Not neccessarily.You can do something like this, for example:myClass = {}function myClass:foo( ) -- self is a reference to the table that stores the function  self:bar( "Pie" ) -- call bar from selfendfunction myClass:bar( a )  print( a )endfunction myClass:create( )  ret = {}  ret.someValue = nil  ret.foo = myClass.foo  ret.bar = myClass.bar  return retenditem = myClass:create( )item:foo( ) -- automatically passes 'item' as 'self' (read above)1:30am, so bear with me if the syntax is a bit off or something.  What I'm saying is that although Lua is primarily a straight-forward procedural language, you can use OO features via its 'syntactic sugar' features (which I have to admit I'm quite happy with).I hope that helps you :)   ;  its actually quite easy to use lua for oop. in my engine i have writen a function called class, which creates an object that can be considered (and used as) a class. then all you got to do is create methods. it looks like this:my_class = class()function my_class:create(x) local o = my_class.__parent.create(self) o.i = x return oendfunction my_class:dump() print("i is set to" .. self.i .. " in this object")endmy_object = my_class:create(7)my_object:dump()and that would actually be valid lua code   ;Quote:Original post by SneftelLua support for classes is closer to Python--offering features which can be used for OOP, including a bit of OOP-specific syntactic sugar--than it is to a language such as C++ or SmallTalk which embeds OOP at the lowest levels of syntax.How is Python less object oriented that C++?! If anything, it is *more* so, since numbers themselves are objects, though both Python and C++ take a multi-paradigm approach, allowing for several modes of programming: OO, modular, procedural -- even somewhat functional, in the case of Python.A better, in fact nearly perfect, comparison would be with Perl. Both build OO on top of dictionarys (hashes in Perlish) with little to no syntactic sugar.;Quote:Original post by sindisilQuote:Original post by SneftelLua support for classes is closer to Python--offering features which can be used for OOP, including a bit of OOP-specific syntactic sugar--than it is to a language such as C++ or SmallTalk which embeds OOP at the lowest levels of syntax.How is Python less object oriented that C++?! If anything, it is *more* so, since numbers themselves are objects, though both Python and C++ take a multi-paradigm approach, allowing for several modes of programming: OO, modular, procedural -- even somewhat functional, in the case of Python.A better, in fact nearly perfect, comparison would be with Perl. Both build OO on top of dictionarys (hashes in Perlish) with little to no syntactic sugar.Maybe I'm missing something, but I don't think he said it was less object oriented than C++...   ;  Not that I'm interrested in a "pureness" flame war, but that's exactly what he implied by saying that Python didn't embed OOP at the lowest levels of syntax. I'm just trying to avoid mischaracarization of Python, that's all.   ;  Actually support for OOP is very different in Python than in Lua.In Python the language has a real object system, in which inheritance, virtual functions, objects, and classes are natively supported.In Lua, OOP is emulated using tables (which is the "only" native complex data type Lua has), and inheritance and others are emulated via metatables.  Lua provides syntax sugar for such emulation, but at the center of the system there are no such things are objects, only Tables.   