This topic contains 68 replies, has 60 voices, and was last updated by  Casey Trauer 8 months, 1 week ago.

LUA fact scavenger hunt

  • Lua is a very interesting language and here is a great place to post interesting facts about it. So read these interesting facts then go out to the web find your own interesting fact about LUA and post it here, or add to a current post to deepen our understanding about it.
    Please be sure to insert a link to the website you found for reference too!

    “Lua” (pronounced LOO-ah) means “Moon” in Portuguese

    You might have noticed that when creating variables, you did not have to specify which type of variable you are creating.

    You might have noticed that when creating variables, you did not have to specify which type of variable you are creating.
    For example.

    a = 1
    b = "hello"
    c = { item1="abc" }

    In other languages, such as C, we have to specify the type of a variable when we create it. In Lua we can also assign different types of values to the same variable.
    This is called dynamic typing. This means that you don’t have to specify what type a variable is. The variable knows what type it is from the value, or object, assigned to it.

    Since comments within code are always important…

    -- A comment in Lua starts with a double-hyphen and runs to the end of the line.
    --[[ Multi-line strings & comments
    are adorned with double square brackets. ]]
    --[=[ Comments like this can have other --[[comments]] nested. ]=]

    Lua runs on all flavors of Unix and Windows, on mobile devices (running Android, iOS, BREW, Symbian, Windows Phone), on embedded microprocessors (such as ARM and Rabbit, for applications like Lego MindStorms), on IBM mainframes, etc.


    Jeff Drumm ◊ VP and COO ◊ HICG, LLC. ◊

    Roberto Ierusalimschy released his third edition of Programming in Lua in January 2013

    Lua was used in Angry Birds.

    Lua is a language for extending applications. 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.

    Concatenating two strings in Lua is accomplished by using “..” (two dots).

    print("Hello " .. "There!") --> Hello There!
    print(00 .. 7) --> 007

    If any of its operands is a number, Lua converts that number to a string.

    Lua is a language for extending applications. 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.

    Lua was used in Angry Birds.

    Not just Angry Birds but many others great article about how Lua is used for many phone apps.

    Lua is a multi-paradigm language, this means that it can be used for both Object Oriented, as well as Functional programming. It doesn’t include inheritance specifically, (but does allow it to be implemented), and it also includes first class functions. (Which means that functions can be passed and returned just like regular variables can be)

    (This was from both a presentation I had seen in grad school, and verified from Wikipedia at

    Lua is the language used to create UI addons to the game client for the popular MMORPG World of Warcraft. Addons can be as simple as placing a single box on the screen displaying your character’s exact coordinates in the game world, or as extensive as a highly-customized complete UI replacement.

    One of the fan-created wikis for WoW,, lists a number of Lua functions to use in creating addons, both standard Lua and those created by Blizzard for the development community.

    -Robert James,
    Interface Analyst,
    GetWellNetwork, Inc.

    I found it interesting while reading to note that Lua was born of necessity by Brazil’s strong trade barriers for hardware and custom software. The developers of the language took the tools available to them (ANSI ‘C’, SOL, etc.) and chose to implement some of the best features of current languages into their own language. Keeping in mind that many if not most users would not be programmers, they managed to produce an easy to use and powerful language. Most often, one has a choice of languages that are either powerful, but difficult to learn and use or easy to learn and use but not very limited in what they can do.

    Lua is the language used for prototyping and scripting for wireshark. I should have known that after using it for many years. Also it appears many video game companies use the language for extend ability for the modding community.

    Variables in Lua are typeless.

    Lua starts indexing arrays from 1 not 0. The reason for this is, like @rclar32 mentions, Lua design evolved for the engineers of a Brazilian oil company who were more likely to use FORTRAN, rather than from a programming community.

    There is a free open source iPhone project named WAX. The WAX project allows you to automatically bridge Lua and Objective-C; therfore you can access anything written in Objective-C using your Lua code automatically.

    Here is the link to know about summary of the main events around and about Lua.

    A quick and easy way to test your Lua script is to use the online Lua demo found at

    Fun Fact: The Portuguese words for Iguana and Chameleon are Iguana and Camaleão.

    Another way to concatenate strings: use the table.concat function.


    sAttending = "Major Charles Emerson Winchester III, 123456"
    count = 0
    t = {}                                        -- create table
    for i in string.gmatch(sAttending, "%w+") do  -- populate table
      count = count + 1
      t[count] = i
    print(table.concat({t[6], t[4], t[2], t[3], t[5], t[1]},"^"))



    Since comments within code are always important…

      <li class="L0"><span class="pun">--</span><span class="pln"> A comment </span><span class="kwd">in</span><span class="pln"> </span><span class="typ">Lua</span><span class="pln"> starts </span><span class="kwd">with</span><span class="pln"> a </span><span class="kwd">double</span><span class="pun">-</span><span class="pln">hyphen </span><span class="kwd">and</span><span class="pln"> runs to the </span><span class="kwd">end</span><span class="pln"> of the line</span><span class="pun">.</span><span class="pln"></span><br><li class="L1"><span class="pln"></span><span class="pun">--[[</span><span class="pln"> </span><span class="typ">Multi</span><span class="pun">-</span><span class="pln">line strings </span><span class="pun">&</span><span class="pln"> comments</span><br><li class="L2"><span class="pln">are adorned </span><span class="kwd">with</span><span class="pln"> </span><span class="kwd">double</span><span class="pln"> square brackets</span><span class="pun">.</span><span class="pln"> </span><span class="pun">]]</span><span class="pln"></span><br><li class="L3"><span class="pln"></span><span class="pun">--[=[</span><span class="pln"> </span><span class="typ">Comments</span><span class="pln"> like </span><span class="kwd">this</span><span class="pln"> can have other </span><span class="pun">--[[</span><span class="pln">comments</span><span class="pun">]]</span><span class="pln"> nested</span><span class="pun">.</span><span class="pln"> </span><span class="pun">]=]</span>

    Is there any benefit to having a comment nested within a comment? Isn’t the whole thing still just a comment?

    Lua is really lightweight and open source–Can’t get any better

    To search:
    string.find (s, pattern [, init [, plain]])

    Looks for the first match of pattern in the string s. If it finds a match, then find returns the indices of s where this occurrence starts and ends; otherwise, it returns nil. A third, optional numerical argument init specifies where to start the search; its default value is 1 and can be negative. A value of true as a fourth, optional argument plain turns off the pattern matching facilities, so the function does a plain “find substring” operation, with no characters in pattern being considered “magic”. Note that if plain is given, then init must be given as well.

    If the pattern has captures, then in a successful match the captured values are also returned, after the two indices.

    Searching for “LUA Gotchas”:
    Brings up a number of good LUA centric sites covering issues unique to the LUA development experience.

    Lua is case-sensitive

    LuaJIT is a Just-In-Time Compiler (JIT) for the Lua programming language. Lua is a powerful, dynamic and light-weight programming language. It may be embedded or used as a general-purpose, stand-alone language.


    I learn that a lot of applications and games used Lua from link below. I didn’t know Lua is use by Adobe Photoshop, Apache HTTP Server and the Firefox web browser.

    I learned that Lua is portable. It’s OS/hardware agnostic. It can run in Windows, Linux/Unix, Mac and even mobile device/embedded microprocessors. I found this on the web site:

    Fun Fact, you can use the following program to define a function to compute the fact and print it for fun. (Ok bad joke, but I tried!)

    The following program defines a function to compute the factorial of a given number, asks the user for a number, and prints its factorial:

    — defines a factorial function
    function fact (n)
    if n == 0 then
    return 1
    return n * fact(n-1)

    print(“enter a number:”)
    a =“*number”) — read a number

    Lua is a very interesting language and here is a great place to post interesting facts about it. So read these interesting facts then go out to the web find your own interesting fact about LUA and post it here, or add to a current post to deepen our understanding about it. Please be sure to insert a link to the website you found for reference too!

    The Jacksonville Jaguars credit Lua for
    helping them connect their entire organization!

    You can learn Lua in 15 minutes

    More than one variable can be defined at once:

    a,b = 10,20

    Variable values can be swapped:

    a,b = b,a -- 10 is now assigned to b and 20 to a


    Functions can return more than one value.

    function Convert(DegC,WindKPH)
    DegF = (DegC * (9/5)) + 32 -- Formula for converting Celsius to Fahrenheit
    WindMPH = WindKPH / 1.609344 -- Formula for converting Kilometers per hour to Miles per hour
    return DegF, WindMPH
    DegF, WindMPH = Convert(20,16) -- assigns 68 to DegF and 9.941939 to WindMPH


    Casey Trauer,
    Director, Client Education

    Most interesting fact for me (at this stage of my learning):
    Nowadays, several game companies use Lua (e.g., LucasArts, BioWare, Slingshot Game Technology, and Loewen Entertainment) and knowledge of Lua is a marketable skill in the game industry.

    Found: SBLP 2001 invited paper
    reprint from Proceedings of V Brazilian Symposium on Programming Languages (2001) B-14–B-28. [ps]
    ‘The evolution of an extension language: a history of Lua’
    by Roberto Ierusalimschy, Luiz Henrique de Figueiredo, Waldemar Celes

    If LUA can handle the intricacies of a ‘game’, it surely can handle the daily operations of data movements.

    When is the next version due?

    Lua is in continuous development but new versions are infrequent.

    Lua 5.3 was released on 12 Jan 2015.

    Search for “What applications use LUA?”

    Lua was created in 1993 by Roberto Ierusalimschy, Waldemar Celes and Luiz Henrique de Figueiredo at the Pontifical Catholic University in Rio de Janeiro, Brazil. It is used in a range of applications including Mi Casa Verde, Adobe Lightroom, Celestia, lighttpd, LuaTeX, nmap, Wireshark, Cisco’s Adaptive Security Appliance, pbLua, and a ton of games including Grim Fandango, World of Warcraft, Tap Tap Revenge, and many others. Lua’s license is a variation of the MIT License—this means that there are essentially no hurdles to including Lua in both commerical and non-commerical projects.

    “Lua has become an extremely popular programming language, so much so that it’s achieved a critical mass of developers in the game industry, meaning Lua skills are transferable from company to company. That’s partly due to its speed and the ease with which developers can embed Lua into a game engine.”

    Nicholas Hallas

    Lua is a lot like Java. It’s code is compiled into bytecode which is then processed thru a virtual machine (VM) at run time. The availability of the LuaJIT also parallels the use of a JIT in Java to speed up execution.

    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 for Kids is a website where you can go to help teach your kids how to program. It even has tutorials so I figured if this lesson is over my head I can go take the kid class. 🙂

    “Aside from being the Portuguese word for moon, Lua is a lightweight but powerful scripting language (meaning that it’s not compiled like C or Java) that also has the great benefit of being easy to learn. While it’s not the most popular programming language in the world, Lua is widely used in gaming and its use is growing quickly.
    So I installed Corona SDK for myself and began playing around. It wasn’t long before I came to see this framework as the easiest and quickest way for children to learn how to program. And by program, I’m talking about real apps that are popular on the Apple iOS and Android app stores.
    So, Lua is a proven entry language for kids, and Corona SDK provides a cost-free, easy way to make use of Lua to build real apps for almost any platform. And that, for me, was the critical piece. It’s not enough for the language itself to be easy to learn. There has to be a simple way to take that code and make it something real. That kind of clear incentive is hard to beat for kids (or anyone else, for that matter).”

    From <;

    Lua was created in 1993 by Roberto Ierusalimschy, Luiz Henrique de Figueiredo, and Waldemar Celes, members of the Computer Graphics Technology Group (Tecgraf) at the Pontifical Catholic University of Rio de Janeiro, in Brazil.

    LUA has been around for a while!

    SEMISH’94 paper
    reprint from Proceedings of XXI Brazilian Seminar on Software and Hardware (1994) 273–283. [ps]
    The design and implementation of a language for extending applications
    by Luiz Henrique de Figueiredo, Roberto Ierusalimschy, Waldemar Celes Filho

    Abstract.We describe the design and the implementation of Lua, a simple, yet powerful, language for extending applications. Although Lua is a procedural language, it has data description facilities, and has been extensively used in production for several tasks including user configuration, general-purpose data-entry, description of user interfaces, description of application objects, and storage of structured graphical metafiles.

    This talk will discuss the latest developments in the world of LuaRocks, the package manager for Lua modules. It will start by introducing the LuaRocks tool, for those who are not familiar with it. Then, I will present what has changed in this past year: the move to a open repository, automation of the upload process and the latest efforts in making the tool more flexible. A revision of the format for specification files (rockspecs) has been long overdue, and in this talk we’ll discuss the changes needed to make the format fully extensible.


    I have been an open source advocate for many years, and love how the community continues to teach and expose me to many new technologies. Prior to finding this great Integration engine (Iguana) – I never had any exposure to Lua. Through my research I found many great uses for this compact yet powerful scripting language. One such project is called Torch:

    “Torch is an open source machine learning library, a scientific computing framework, and a script language based on the Lua programming language.[3] It provides a wide range of algorithms for deep machine learning, and uses an extremely fast scripting language LuaJIT, and an underlying C implementation.”


    Lua is used in many products and projects around the world, including several well-known games.
    A few examples are: Adobe Photoshop, Angry Birds, and Apache HTTP Server

    There seem to be multiple ways to learn LUA, online and in text.
    One example

    The LUA conf will be held in Stockhom, Sweden for 2015

    LuaJIT is a Just-In-Time Compiler (JIT) for the Lua programming language.

    A good place to start learning Lua is the book Programming in Lua, available in paperback and as an e-book. The first edition is freely available online.

    Compared to a lot of other languages (not all though!), Lua relies heavily on tables to form other data types.

    For example, a table, by default, is essentially an array; however, you can use a string for a key to turn a table into a customized structure.

    A table can also have functions as values and, therefore, act as a namespace.


    Another common use for LUA is in embedded devices including cameras (Canon), keyboards (Logitech),
    printers (Olivetty & Océ), according to Stanford lecture by Roberto Ierusalimschy

    Lua is used in Lego Mindstorms

    You can easily build Lua from source on your Linux or Mac OS X system.

    Lua programs are not interpreted directly from the textual Lua file, but are compiled into bytecode which is then run on the Lua virtual machine. The compilation process is typically invisible to the user and is performed during run-time, but it can be done offline in order to increase loading performance or reduce the memory footprint of the host environment by leaving out the compiler. Lua bytecode can also be produced and executed from within Lua, using the dump function from the string library and the load/loadstring/loadfile functions, respectively.

    Like most CPUs, and unlike most virtual machines (which are stack-based), the Lua VM is register-based, and therefore more closely resembles an actual hardware design. The register architecture both avoids excessive copying of values and reduces the total number of instructions per function. The virtual machine of Lua 5 is one of the first register-based pure VMs to have a wide use.[10] Perl’s Parrot and Android’s Dalvik are two other well-known register-based VMs.

    This example is the bytecode listing of the factorial function defined above (as shown by the luac 5.1 compiler):[11]

    Announcing Game Developer magazine’s 2011 Front Line Award winners:

    Programming tool
    Roberto Ierusalimschy, Luiz Henrique de Figueiredo, and Waldemar Celes

    Lua has become an extremely popular programming language, so much so that it’s achieved a critical mass of developers in the game industry, meaning Lua skills are transferable from company to company. That’s partly due to its speed and the ease with which developers can embed Lua into a game engine. Lua is also highly extensible — it’s simple to expand its functionality with libraries either written in Lua, or as extensions in other languages. And it’s relatively small and simple, both in terms of the source files, and the resultant code and run-time memory usage.

    An interesting aspect of OO in Lua is that you do not need to create a new class to specify a new behavior. If only a single object needs a specific behavior, you can implement that directly in the object.

    Lua (“Moon” in Portuguese), is a lightweight and fast scripting language which can be easily embedded in other systems. If you know a tiny bit of C or Java, you’ll be able to understand (and possibly write) 80% of Lua code without reading a single line of its documentation.

    Despite its simplicity, Lua is considered a multi-paradigm language supporting imperative, functional and even object-oriented approaches. More specifically, Lua’s tables provide a simple but powerful way to create arrays, hashes and even classes (or better, prototypes). Simple (and multiple) inheritance is achieved through metatables, which allow calls to undefined functions to be transferred to parent tables.

    Q: When do I need to worry about memory?

    A: The short answer is: only when you have to worry. Generally Lua does The Right Thing, but if memory use is excessive, then you do need to understand something about memory management in Lua.

    People can get anxious about having a lot of string objects in memory. But Lua interns strings, so that there is really only one copy of each distinct string. So this code uses less memory than you would think:
    local t = {}
    for i = 1,10000 do
    t[i] = {firstname = names[i], address = addr[i]}

    It also makes string equality tests very fast.

    Excessive string concatenation can be slow and inefficient. Here is the wrong way to read a file into a string:
    local t = “”
    for line in io.lines() do
    t = t .. line .. ‘\n’

    This is bad, for the same reason that doing this in Java or Python would be a bad idea; strings are immutable, so you are constantly creating and discarding strings.

    If you do need to concatenate a lot strings, put them into a table and then stitch them together with table.concat()

    Lua, like most modern languages, is garbage-collected. Memory allocated for tables, etc is automatically collected when the data is no longer referenced. Say we have t = {1,2,3} and later the assignment t = {10,20,30} happens; the original table is effectively orphaned, and gets collected next time the garbage collector comes around.

    So the first thing to bear in mind is that data memory will only be freed if you genuinely have no references to that data. And the second is that it will generally not happen at the time of your choosing, but you can force a collection with collectgarbage(‘collect’). A subtle point here is that calling this function twice is often needed, because any finalizers will be scheduled for execution in the first pass, but will only execute in the second pass.


    Lua is common in gaming.

    Lua Wiki page

    Lua is an open source language built on top of C programming language. Lua has its value across multiple platforms ranging from large server systems to small mobile applications. This tutorial covers various topics ranging from the basics of Lua to its scope in various applications.

    This Youtube video is a nice and quite thorough introduction to Lua.

    Lua means “moon” in Portuguese, and as a programming language, it was voted in 2003 by as the most popular scripting language for game programming. Source:

    Lua has been used to help give robots eyes!

    Test comment by Lev

    Here is an interesting reddit thread on why Lua isn’t more widely used:

    It excels as a secondary language, but other languages have a stronger foothold as scripting languages.

    In video game development, Lua is widely used as a scripting language by game programmers, perhaps due to its perceived easiness to embed, fast execution, and short learning curve. In 2003, a poll conducted by showed Lua as the most popular scripting language for game programming.

    The shorthand for adding values to the same variable (i+=1, i-=1, i++, etc…) don’t exist in Lua!

    Sheesh, Marcus. So negative! 😉

    Casey Trauer,
    Director, Client Education

You must be logged in to reply to this topic.