user53670
user53670

Reputation:

Is Lua an object-oriented language?

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

Upvotes: 4

Views: 11790

Answers (5)

Micael Bergeron
Micael Bergeron

Reputation: 1174

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

Upvotes: 0

Remo.D
Remo.D

Reputation: 16522

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.

Upvotes: 1

Judge Maygarden
Judge Maygarden

Reputation: 27593

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.

Upvotes: 13

jcoder
jcoder

Reputation: 30035

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

Upvotes: 1

Justin Niessner
Justin Niessner

Reputation: 245429

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

Upvotes: 0

Related Questions