3

Is this language an OO language? Is it often used as OO language?

Judge Maygarden
  • 26,961
  • 9
  • 82
  • 99

5 Answers5

13

Lua is fully capable of prototype-based object-oriented programming similar to JavaScript.

Prototype-based programming is a style of object-oriented programming in which classes are not present, and behavior reuse (known as inheritance in class-based languages) is performed via a process of cloning existing objects that serve as prototypes. This model can also be known as class-less, prototype-oriented or instance-based programming. Delegation is the language feature that supports prototype-based programming.

For more information, see Chapter 16 - Object-Oriented Programming of the Programming in Lua book.

Judge Maygarden
  • 26,961
  • 9
  • 82
  • 99
1

It does support object oriented programming with some difficulty. This chapter in the official guide explains http://www.lua.org/pil/16.html

jcoder
  • 29,554
  • 19
  • 87
  • 130
1

Lua it's not an OO language "per-se" but offers mechanisms to implement different styles of Object Orientation.

There are a lot of libraries that implement OO for lua. A look at lua.org (the main Lua site) or lua-users (the Lua Community Wiki) will be helpful.

Even more helpful would be to ask in the Lua Mailing list.

Remo.D
  • 16,122
  • 6
  • 43
  • 74
0

Lua is a powerful, fast, lightweight, embeddable scripting language.

Lua combines simple procedural syntax with powerful data description constructs based on associative arrays and extensible semantics. Lua is dynamically typed, runs by interpreting bytecode for a register-based virtual machine, and has automatic memory management with incremental garbage collection, making it ideal for configuration, scripting, and rapid prototyping.

~ Lua: about

Justin Niessner
  • 242,243
  • 40
  • 408
  • 536
0

It's mostly used as a scripting tool in Apps, to extend or implement functionalities.

Micael Bergeron
  • 1,154
  • 7
  • 13