Author Topic: How much experience in Lua is needed prior to starting to use Solarus?  (Read 2173 times)

paragonx9

  • Newbie
  • *
  • Posts: 10
    • View Profile
I have never "dived" deep into the world of programming, although I have some basic knowledge of C++. I recently watched one of the video tutorials, and in the description, it had a link to a tutorial for Lua. So, I wonder, how much / what parts of Lua should you learn before using Solarus? I know this is a weird question, considering you can't really tell someone how much programming they should know, but how long should I "study" Lua before taking a shot at making a game at Solarus?

Christopho

  • Administrator
  • Hero Member
  • *****
  • Posts: 1146
    • View Profile
Re: How much experience in Lua is needed prior to starting to use Solarus?
« Reply #1 on: August 07, 2013, 07:38:01 am »
TL;DR
Chapters 1 to 5 of http://www.lua.org/pil/contents.html

That'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.html
I 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).