Things to remember when working with Lua
The following are concepts that you need to keep in mind when working with Lua.
Comments
A comment can be anything between a double-hyphen and the end of the line:
--This is a comment
Comment blocks are also supported. They are delimited by the --[[
and ]]
characters:
--[[ This is a multi-line comment block. ]]
Dummy assignments
There are occasions where you don't need all the information returned by a function, and in Lua, you can use dummy assignments to discard a return value. The operator is _
(underscore):
local _, _, item = string.find(<string>, <pattern with capture>)
Indexes
Indexes start at one, not zero:
z={"a","b","c"} z[1]="b" --This assignment will change the content of the table to {"b","b","c"}
However, you can initialize an array at any value:
nmap = {} for x=-1337, 0 do nmap[x] = 1 end
Important note...