Introducing our new Lua cheat sheet | Opensource.com

Introducing our new Lua cheat sheet

Download our handy Lua cheat sheet and make writing in the minimalistic, lightweight language even faster.

Cheat Sheet cover image
Image by : 
Opensource.com
x

Subscribe now

Get the highlights in your inbox every week.

Lua is a minimalistic, lightweight language implemented as a C library. It's fast and simple to learn, efficient to run, embeddable, and tiny (its source code download is under 500 KB, and it's just over 1MB compiled). You can use Lua to create an API for your application or as a scripting language, for quick prototyping, or as the foundation of your software project.

Not only is Lua simple in design, but it's also consistent in ways that many other languages are not. It has explicit scoping (so it's not dependent on indentation), it interfaces with C through simple wrappers, and it can accept raw C data as a data type. Lua's syntax is direct and predictable, so once you learn a few structures, the rest is largely intuitive.

For example, the end keyword is used to close a clause, whether that clause is an if statement, a for or while loop, or a function. The table construct is the sole data-structuring mechanism in Lua, and it can be used to represent ordinary arrays, lists, symbol tables, sets, records, graphs, or trees, and it can even mimic object-oriented classes. Broad statements about Lua are plentiful, and they usually apply equally across the language. There aren't exceptions to the syntax: once you learn something, you can use that principle no matter what you're writing in Lua.

Lua is simple enough to fit on one side of a single-page cheat sheet, but we created a two-page cheat sheet for notes about syntax, data structures, important variables, and a few tricks and tips. Whether you're new to Lua or you've been using it for years, download our Lua cheat sheet and keep it handy. It'll make Lua (or at least writing it) even faster.

Download your Lua cheat sheet

Coding on a computer

Luarocks makes it easy to get started with Lua, a lightweight, efficient, and embeddable scripting language.
Open data brain

Discussing Tarantool this year at the Percona Live Data Performance Conference.

Topics

About the author

Seth Kenlon
Seth Kenlon - Seth Kenlon is a UNIX geek, free culture advocate, independent multimedia artist, and D&D nerd. He has worked in the film and computing industry, often at the same time. He is one of the maintainers of the Slackware-based multimedia production project Slackermedia.