Lua

Click on image to go to http://www.lua.org

I will begin my tutorials with an introduction to Lua, the scripting language used in CoronaSDK mobile app development. Objective-C is Apple’s programing language of choice for developing iOS apps, but I found that it was too difficult and time-consuming to create apps as quickly as I would like. CoronaSDK’s Lua scripting language is simple and elegant, and allowed me to create TicTacToe Island in three weeks spending just a few hours a day.

While you can jump into the CoronaSDK and start learning how to program in Lua, I found it to be much simpler to install Lua on my computer get familiar with the language via the command line. “I hate the command-line!!!!” you may be shouting. I assure you that if you are programming in any language, you should be familiar using the command line. The command line allows you to test out a line or lines of code and get instant results. For example, if you wanted to test a simple math equation using CoronaSDK, you would have to do the following:

  1. open your main.lua file
  2. enter your equation “print(1+2)”
  3. start the corona simulator
  4. load your main.lua file

You will then have to look in the command line window for the output.

Testing the equation at the command line is as simple as typing
lua -e "print(1+2)"

When first learning Lua, I played with it on the command line extensively while going through online tutorials and trying out my own code. Once I was familiar and comfortable with Lua, I started working with the CoronaSDK. I still use Lua on the command line to test out snippets of code and heavily recommend that you install Lua on your development machine.

Installing Lua for Windows is as simple as downloading the installer from http://luaforwindows.luaforge.net/

I used MacPorts to install Lua for OSX.
sudo port install lua

Links:

Published On: February 15th, 2012 / Categories: Tutorial / Tags: , , , /

Subscribe To Receive The Latest News

Curabitur ac leo nunc. Vestibulum et mauris vel ante finibus maximus.

[contact-form-7 id=”1362″ /]

Add notice about your Privacy Policy here.