In this tutorial, part 4 of our series on learning Lua scripting, we will look at some of the tools available for working with Strings in Lua.
Concatenation in an important concept in all programming languages. In Lua, concatenation is accomplished by using two periods in a series or ..
There are many escape sequences available in Lua including newline:
The example adds a new line (\n), a tab at the beginning of the newline (\t), and quotes around the word “newline”. One caveat to using escape sequences; they do not require any spaces around them.
One last tip for creating strings in Lua. If you want to create a multi-line string, you can use [[ ]] to encapsulate the string.
Programming in Lua by Roberto Ierusalimschy, one of the lead architects of Lua. Great technical intro to the language.
Lua 5.2 Reference Manual also by Roberto Ierusalimschy, is, as the name implies, a less expensive reference manual. Useful for the experienced coder who just needs to look up some of the details of
Lua Programming Gems by L. de Figueiredo, W. Celes, and R. Ierusalimschy is an older (2008) collection of code snippets that can be useful.
We used the Zerobrane editor in all of our video demonstrations.
We have several books on Corona and Amazon Lumberyard (both of which use Lua as their scripting language):
Learning Mobile Application & Game Development with Corona – Learn to program in Lua and how to make mobile apps! eTextbook for those who are new to programming.
Beginning Mobile App Development with Corona – Introduces mobile application development for those who already know how to program.
Game Design Fundamentals with Amazon Lumberyard – For those who are new 3D Game development, this eTextbook introduces how to make a game using Blender, GIMP, and Amazon Lumberyard.
The idea of writing a textbook on the Lua Scripting language has been floated to me. While I greatly value Dr. Ierusalimschy, our styles of instruction are very different. Leave me a comment if you would like to see a Lua Scripting textbook.