Learning Lua

powered-by-lua.gif

Welcome to coding in Lua.  This site explains the use of Lua, and more precisely, writing Lua code for embedded applications using the microMighty framework.  First things first.  You may not have ever heard of the the language Lua before, so as a quick history lesson here is the backstory for the Lua language.

Lua was created and is still maintained by its creators at PUC-Rio in  Rio de Janeiro, Brazil.  The Language was first developed in the TecGraf, a computer graphics center, and is now hosted by LabLua at PUC-Rio. Lua means "moon" in Portuguese, hence the naming of our boards for the moons of Jupiter (Callisto, Europa, IO, Ganymede)

Lua is described as a "powerful, efficient, light weight, embeddable scripting language" (lua.org).  It can support all kinds of programming models, such as object-oriented and procedural programming. And is pretty helpful describing data and setting configuration options as well.  Lua can be used both for the application code as well as the configuration and data files!

The language is s great combination of procedural programming (simple to learn) and associative arrays and meta data (powerful) for data description that make for a very powerful combination.  This enables complex applications development with tools no more complex than a text editor, while still being a very approachable and readable language for a beginner.

Where it is used

Where is Lua used?  Lua has been used in all sorts of applications from Adobe Lightroom, to World of Warcraft, Angry BIrds, and Roblox.  It has been used in many other applications, such as TV software as well.  But what about the embedded world?  Other than the microMighty framework, Lua was used in embedded applications such as eLua (Lua 5.1), and is used for the White Cat IoT boards.  This broad base of applications is part of the reason that we chose Lua when creating the microMighty framework.

Advantages

Lua is a fast, portable, and flexible language that is both easy to learn and easy to extend (very important for adding embedded functionality).  Lua is also very efficient and small.  Yes, there are other languages that are powerful, and easy to learn (e.g. Python), but they are neither as efficient nor are they as lightweight and speed from the execution of the compiled bytecodes.  Quite simply, we use Lua because Lua is the best-fit for what we wanted to achieve with the embedded processors we produce: Simple to Learn, Powerful Enough for Real applications, and Efficient with the limited resources of a mocrocontroller with no memory-management unit (MMU).

For loads of infrmation, technical papers, and even the full Lua language reference, visit Lua.org.