Lua in a Weekend! (Lua basics by example in 5 pages)

Lua in a Weekend

This is a reference doc I made, while learning the basics of Lua, some days ago.

I was planning to edit and enrich the document with more advanced concepts, but I changed my mind yesterday when I saw how many newcomers may need something light “asap”, to help themselves quickly feel comfortable with Lua in Corona SDK.

Feel free to leave any corrections, tips or other feedback…
[import]uid: 7356 topic_id: 2650 reply_id: 302650[/import]

Awesome setup!!!
This will help many just getting started. [import]uid: 9492 topic_id: 2650 reply_id: 7651[/import]

Thanks this will help A lot [import]uid: 7911 topic_id: 2650 reply_id: 7689[/import]

You may find the following short LUA references also helpful:

http://www.capgo.com/Resources/SoftwareDev/LuaShortRef51.pdf

and

http://lua-users.org/files/wiki_insecure/users/thomasl/luarefv51.pdf

Their print-outs have been next to my keyboard while I’ve been trying to master Lua’s peculiarities…

-Frank.

[import]uid: 8093 topic_id: 2650 reply_id: 7704[/import]

@magenda : twitter the link so I can re-twitter it.

me. [import]uid: 24 topic_id: 2650 reply_id: 7714[/import]

@carlos

@Noocell
[import]uid: 7356 topic_id: 2650 reply_id: 7753[/import]

These are all great reference, thank you! [import]uid: 13670 topic_id: 2650 reply_id: 15968[/import]

oh neat a corona dev made that resource, I found it weeks ago while searching online for information about lua.

a note for newcomers: this is probably not much use to beginner programmers; it’s more a cheat-sheet for experienced coders to correlate with lua what they already know from other languages. [import]uid: 12108 topic_id: 2650 reply_id: 15994[/import]

I am glad to hear that the tiny Lua reference booklet that helped me to be introduced to Lua also helps other people to get their hands on this marvelous language!

You can use this short guide with 2 ways:

  1. As a quick tutorial which waits for you to try the provided code snippets in http://www.lua.org/cgi-bin/demo and learn the basics of Lua by example.

  2. As a short reference booklet that you can print and consult for the first days/weeks of your flirt with Lua. The words in bold are the “hot points” that help you easily recall the exact syntax for a task and demonstrate some of the basic capabilities of Lua.


After your first days with Lua I suggest you bookmarking the following API indexes and open them in advance every time you sit down to write some code in Corona:

http://www.lua.org/manual/5.1/index.html#index

http://developer.anscamobile.com/resources/apis/

Don’t forget that when you see something like [lua]string.gsub (s, pattern, repl [, n])[/lua] the variables in brackets are optional arguments. [import]uid: 7356 topic_id: 2650 reply_id: 15998[/import]