Lua: Syntax
From Mario Fan Games Galaxy Wiki
Revision as of 01:36, 6 October 2009 by Draco Icebane (talk | contribs)
| Lua |
|---|
|
| Basics |
| Intermediate |
| Advanced |
|
| XLua |
| Add to this template |
Lua syntax is relatively simple due to Lua's smaller direct library of features. Most of these features are, in practice, similar to those of other languages such as C or PHP.
Chunks and blocks
A chunk is a bunch of statements one after the other in no particular hierarchy:
print("text") -- Part of a chunk
print("text") -- Part of a chunk
print("text") -- Part of a chunk
print("text") -- Part of a chunk
A block is a family of statements belonging to a function:
do
print("Hello World") -- Part of a block
endVariables defined within a do block are local to that block, and cannot be accessed from outside of it.
