Game Development Reference
In-Depth Information
Variables
In simple computing terminology, a variable is a location that holds a value and can be accessed by
giving it a name. Think of it as a filing cabinet in a company's HR department. It can hold many files
with details on the employees. When you need to access data from one of them, you can look it up
via the file's name tag. If you have two employees with the same first and last names, there need to
be two files and the name tag would require some form of identification to distinguish between the
two. Just as you cannot have two files with the same tag, you cannot have two variables with the
same name. There has to be some point of differentiation (e.g., tag1 and tag2 instead of just tag ).
The names given to the variables can be a series of letters, digits, and underscores; however, they
cannot begin with a digit. The names are case sensitive, so there is a difference between T and t .
In addition to variables, Lua also uses keywords , which cannot be used for variable names, as Lua
identifies them as commands for the code, not variable names. Here's the list of system keywords,
which cannot be used as variable names):
and
break
do
else
elseif
end
false
for
function
if
in
local
nil
not
or
repeat
return
then
true
until
while
 
Search WWH ::




Custom Search