The following keywords are reserved and cannot be used as identifiers:
Lua is a case-sensitive language: is a reserved word, but And
and AND
are two different, valid identifiers. As a convention, identifiers starting with an underscore followed by uppercase letters (such as _VERSION
) are reserved for internal variables used by Lua.
Literal strings can be delimited by matching single or double quotes, and can contain the following C-like escape sequences:
\a
—- bell\b
—- backspace\f
—- form feed\r
—- carriage return\t
—- horizontal tab\v
—- vertical tab\"
—- quotation mark\'
—- apostrophe\[
—- left square bracket
Moreover, a `\
newline´ (that is, a backslash followed by a real newline) results in a newline in the string. A character in a string may also be specified by its numerical value using the escape sequence `\
ddd´, where ddd is a sequence of up to three decimal digits. Strings in Lua may contain any 8-bit value, including embedded zeros, which can be specified as `\0
´.
Numerical constants may be written with an optional decimal part and an optional decimal exponent. Examples of valid numerical constants are
Comments start anywhere outside a string with a double hyphen (--
). If the text immediately after --
is different from [[
, the comment is a short comment, which runs until the end of the line. Otherwise, it is a long comment, which runs until the corresponding ]]
. Long comments may run for several lines and may contain nested [[
· · · ]]
pairs.