Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is Lua based primarily on well-established programming-language ideas? [closed]

People also ask

What is Lua language based on?

Lua combines simple procedural syntax with powerful data description constructs based on associative arrays and extensible semantics.

Is Lua still developed?

Lua is an open-source, multi-paradigm, embeddable scripting language developed by a team from the Pontifical Catholic University of Rio de Janeiro in 1993. Currently, Lua is popular in domains like gaming and web servers. Despite its age and lack of fanfare, developers still use Lua for a variety of things.

Is Lua a real programming language?

Lua (/ˈluːə/ LOO-ə; from Portuguese: lua [ˈlu.(w)ɐ] meaning moon) is a lightweight, high-level, multi-paradigm programming language designed primarily for embedded use in applications.

What type of programming is Lua?

What is Lua? Lua is a robust, lightweight, and embeddable scripting language that supports multiple programming methods, including procedural, object-oriented, functional, and data-driven programming.


This is a very interesting question. My day job is to study programming languages, and Lua will repay careful study. I would say that about very few other languages (perhaps Icon and CLU). Please note that it is the language as a whole, not the individual features, which makes Lua so worthy of study.

Is this a result of interesting new ideas the implementors had, or is it a result of good execution of well-established ideas?

Both. For the details, your best source for an answer to this question is the paper The Evolution of Lua, which appeared at the Third ACM Symposium on the History of Programming Languages. But I will add a few comments.

  • The use of Lua tables as the only mutable, non-atomic type of data was invented by the Lua team. They were inspired by developments in CLU, and I believe they were aware of similar work in Awk and Icon, but the refinement to this degree is an important contribution of the Lua team.

    Tables also have a very efficient implementation, which was invented by the Lua team.

  • The functional features of Lua have the same semantics as Scheme, but Lua has a unique implementation of first-class functions, which I think they ought to submit for publication in the Journal of Functional Programming.

  • The API for embedding has been greatly refined over the years. Its main distinguishing characteristic is that user-defined abstract types can participate fully in the embedding. This is the property that makes the Lua API superior to the Tcl API, for example. The Lua API has undergone a great deal of refinement over the years, including since its first publication at version 2.5. The Lua designers deserve a great deal of credit here.

  • The garbage-collection technology is standard.

  • Lua coroutines represent a new take on some very old ideas. The new take was considered worthy of publication in ACM Transactions on Programming Languages and Systems, so again I think the Lua team get credit for originality.

  • Lua metatables are related to the Common Lisp metaobject protocol.

I think that Lua's success result from a unique combination of strengths of the Lua team:

  • If you read the HOPL paper, you'll see that the Lua team were well aware of many developments in programming languages and were able to choose from among the best ideas. Most designers of popular scripting languages have been amateurs and have not been nearly so well informed.

  • Lua is superbly designed so that the pieces fit together very nicely, with an excellent power-to-weight ratio. This is the result of a lot of refinement over time, and PUC-Rio was willing for the Lua team to work on the language design and implementation instead of grinding out a huge number of papers. This work could not have been done at a North American university.

  • Lua is superbly engineered. The implementation is just staggeringly good. That's partly great work by great engineers and partly the opportunity to keep revising the design over a 15-year period.

I'll close by asking readers not to underestimate the difficulty of choosing and refining well-established ideas to form a coherent whole. This is extremely difficult work and is seldom recognized as it should be.


Lua supports functional programming and it's based on Prototype-based programming style, which is flexible and powerful.

IMO it's an interesting language.

If you want to read some thoughts about prototype inheritance, I suggest you to
read Steve Yegge's The Universal Design Pattern blog post.


Lua is small, the total code is only tens of thousands lines in ANSI C. (Python has ten times mores lines of code).

Lua is very stable, or say, the language is fixed now.

Lua has good engineering. Its code is easy to read and hack. (also because small)

Its license permits you do whatever you want.

Writing C extensions in Lua is easier than other languages, say Python.


There's a Lambda the Ultimate story, Small is Beautiful: the design of Lua, discussing Robert Ierusalimschy's recent talk at Stanford of the same name. The discussion currently focusses on the merits of having tables as the only container data structure; so far, little has been said on the other part of the talk, dealing with Lua's C interface.