TL;DR
Chapters 1 to 5 of
http://www.lua.org/pil/contents.htmlThat's a very good question.
Like always in programming, it is better not to start directly by writing code, but learning and using Lua is easy.
Lua is very minimalist but powerful. There are only a few mechanisms to learn (variables, functions, table, metatables), everything is built using these base mechanisms.
To learn Lua, the best way is to buy the
Programming in Lua book in its latest edition. It is the recommended book.
But you can also read the online version of the first edition of that book, it is free:
http://www.lua.org/pil/contents.htmlI recommend to read chapters 1 to 5, then you know enough to make scripts for Solarus. Later, you should also read chapters 11, 13, 16, 18, 19, 20 to understand what you are doing.
I should make a page or a PDF sheet that summarizes the main features of Lua, on the documentation or the wiki. Especially the ones that are important for Solarus:
- Variables should be declared local unless you know what you are doing.
- Functions are first-class values. The definition of a function is actually an assignment (to a variable or to a table field).
- Tables are the only data structure.
- The semicolon operator is syntaxic sugar to hide the first parameter of a function.
- A Lua script file is a regular function and can take parameters with the syntax ... (3 dots).