Working with the insertion into IOS programming first challenge was to sort through all the different code.
I now have a library of books on C, C+, Objective C, and Lua
All Similar
All Different
The main thing (I have found) to move between each programming language is the ability to forget or separate one syntax and pickup another.
This is my Lua Quick Reference coding Tips sheet for review when I need a jump start
In doing serious brain dumps with C and objective C and then retooling for Lua your brain starts to seize and melt and then I found the short converted German to english guide (link below) For me to understand Ansca Corona I needed to be a little clearer on Lua and once I went back and read through the beginners guide (Written by LUA I understood better what is going on in the code.
Essentially Lua is Algebra Statements with rules
With Algebra you can and do have several ways to get to the same answer that being so it is important to organize your thoughts and if things work use the same methods so
If all else fails go back and read this Lua Guide
Programming in Lua manual is on line 1st Edition by Roberto Ierusalimschy Make sure if you purchase the book since first edition is online you purchase the updated Programming in Lua 2nd edition ISBN 8590379825
Confusing Same Name just Edition changes you want the Dark Blue Cover not the Light Blue
Some hard set Rules and at the bottom are rules – for me to make coding easier to read and stick to rules I try to follow
Variables – Names
It doesn’t matter how we call a variable. However, there are some rules to consider.
- A variable name has to start either with a letter (character) or an underscore.
- Variables are case sensitive Upper case and lower case in a name of a variable is very important: player1 is not equal to Player1
- Only characters, numbers an underscores are allowed.
- Reserved words are not allowed for using as name for a variable.
- Great Coding includes Comments — Is the Lua symbol to identify what follows is a comment — A comment in Lua starts with a double-hyphen and runs to the end of the line. –[[ Multi-line strings & comments are adorned with double square brackets. ]]
Variables can be Global or Local
A local variable only exists in the block it was created in
Variables have the following values
- NIL (nothing)(empty)(not existing)
- numbers
- characters (letters, words, etc.)
- conditions (true/false)(yes/no)(1/0)
- functions (as special case of a block)
- tables (with a lot of others variables stored inside)
FUNCTIONS
Functions are variables that are doing something when they are called.
Functions will be started either with
Calculate = function()
— or with
function Calculate()
and they will be finished with
end
Tables
Tables are variables storing other variables inside them.
Chunks
The unit of Execution of Lua is called a chunk.
Achunk is simply a sequence of statements huge tip is chunks flow they are executed sequentially
Chunks
Can define varibles, recieve arguments and return values
My Rules to Follow (Not Rules of LUA)
- In general my variables will start with a lower case
- Names of my functions will start with an upper case
- Parameters (we will learn about later) will be started with an underscore
- Every new word inside a name of a variable will have an upper case letter.
- Tables are variables storing other variables inside them.