![]() ![]() The pairs() function, which loops over a table. Going back to our example, we can also learn the following: This form loops the variable from the first to the last value, incrementing it by the given increment (defaults to 1) at each iteration. Lua includes all the common flow-control structures you might expect. Instead of detailing every structure, I will focus on the aspects that are most different or that are most likely to trip you up as you learn it. I assume you are a programmer who knows some other C-like language–if you already know C, Java, Ruby, Python, Perl, Javascript or some similar language, picking up Lua should be pretty easy. ![]() The purpose of this section is to give you a quick overview of the Lua features and peculiarities you may find most useful for developing Hammerspoon policies. It is easy to learn and use while having pretty powerful features, and is frequently used in games, but also in many other applications including, of course, Hammerspoon. Lua is a scripting language created in 1993, and focused from the beginning in being an embedded language for extending other applications. Along the way you will discover that Lua is a surprisingly powerful language. In this 2-part article I will show you the basics of Lua so you can read and write Hammerspoon configuration. Hammerspoon’s configuration files are written in Lua, so a basic knowledge of the language is very useful to be an effective user of Hammerspoon. Just Enough Lua to Be Productive in Hammerspoon, Part 1 ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |