A brief history of Lua - Roberto Ierusalimschy (PUC Rio)
1. A Brief History of Lua Roberto Ierusalimschy chief Lua architect
2.
3.
4. DEL Data Entry Language :e gasket "gasket properties" mat s # material d f 0 # distance y f 0 # stress t i 1 # facing type :p gasket.d > 30 gasket.d < 3000 gasket.y > 335.8 gasket.y < 2576.8
20. Lua 2.1: Constructors t = @(size) -- empty t = @[a, b, c] -- list t = @{x = 10, y = 20} -- record t = @foo{x=10, y = 20} -- object t = {} -- empty t = {a, b, c} -- list t = {x = 10, y = 20} -- record t = foo ( {x=10, y = 20} ) -- object Lua 1.1 Lua 2.1
21.
22.
23.
24. Beachhead in Games From: Bret Mogilefsky <mogul@lucasarts.com> To: "'lua@icad.puc-rio.br'" <lua@icad.puc-rio.br> Subject: LUA rocks! Question, too. Date: Thu, 9 Jan 1997 13:21:41 -0800 Hi there... After reading the Dr. Dobbs article on Lua I was very eager to check it out, and so far it has exceeded my expectations in every way! It's elegance and simplicity astound me. Congratulations on developing such a well-thought out language. Some background: I am working on an adventure game for the LucasArts Entertainment Co., and I want to try replacing our older adventure game scripting language, SCUMM, with Lua.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
Notas do Editor
However, after a while, both groups started to experiment limitations with those languages. DEL was already being used in 'production', and users were asking all kinds of extensions.
What we wanted was a &quot;generic little language&quot;, a language that could be used for configuration for any program that needed such language. It should have all features of a programming language, such as conditionals, loops, procedures, assignment, etc. It also should be easily embeddable in any application (that was its main goal!). It should be portable, because Petrobras had a quite diverse array of machines. It should be simple, so we could implement it fast. And it shoud have a syntax somewhat appropriated for non programmers (engineers, geologists, etc.)
What we wanted was a &quot;generic little language&quot;, a language that could be used for configuration for any program that needed such language. It should have all features of a programming language, such as conditionals, loops, procedures, assignment, etc. It also should be easily embeddable in any application (that was its main goal!). It should be portable, because Petrobras had a quite diverse array of machines. It should be simple, so we could implement it fast. And it should have a syntax somewhat appropriated for non programmers (engineers, geologists, etc.)
On one hand, Lua allowed definitions that looked exactly like in Sol. For instance, this definition for a track is exactly as it were in Sol
On the other hand, the semantics was radically different. In Lua, that definition was an assignment, and the &quot;at&quot;-name syntax was a kind of constructor: it created an object with the given fields (x, y and title) and called the named function (&quot;track&quot;). That function then could do whatever it needed: type check each field, assign default values, check any kind of condition, etc.
The first implementation was really simple and unpretentious. We did not even used a revision control system! The interpreter precompiled the code into bytecodes and then interpreted the bytecodes with a virtual stack machine (inspired in Modula's M machine). The compiler was written with Lex and Yacc, and was strictly one pass, with no intermediate representation. The whole system had less than five thousand lines of C code.
We really did have few expectations for Lua 1.0 (as witnessed by its implementation). We wanted to solve our problems with our projects, and with luck also help other projects at Tecgraf. In the end we were very happy with the result. Soon, other projects started using Lua for several different tasks.
Around 1994, OO fever was in its height. The two most frequent questions we heard were &quot;is Lua an object-oriented language?&quot; and &quot;why not?&quot;. So, we started a new version to try to better answer those questions. Lua 2.1 started two important (but not necessarily good) trends in Lua: incompatibility changes between versions and avoiding though decisions.
Inspired by Self, we decided for a prototype-based mechanism. We wanted the easiest modification to the language that would allow us to answer &quot;yes, Lua is an object-oriented language&quot;. (Or, more exactly, &quot;can be an object-oriented language!) We added a mechanism called &quot;fallbacks&quot; to Lua.
A major change was in the syntax. We unified the different kinds of constructors in an uniform syntax. More important, we removed the concept of &quot;constructor&quot; (in the OO sense) and replaced by a syntactic sugar for function calls.
During that period, Lua slowly started to attract some attention outside Tecgraf and PUC. Its first home page was inside my personal page. As we started to receive several questions from outside, we decided to create a list, so that users could answer the questions from other users.