13: Introduction to TSP commands 2470 High Voltage SourceMeter Instrument
13-14 2470-901-01 Rev. A / May 2019
Lua reserved words
Values and variable types
In Lua, you use variables to store values in the run-time environment for later use.
Lua is a dynamically-typed language; the type of the variable is determined by the value that is
assigned to the variable.
Variables in Lua are assumed to be global unless they are explicitly declared to be local. A global
variable is accessible by all commands. Global variables do not exist until they have been assigned a
value.
Variable types
Variables can be one of the following types.
Variable types and values
Variable type returned Value Notes
The type of the value nil, whose
main property is to be different from
any other value; usually it represents
the absence of a useful value.
Boolean is the type of the values
false and true. In Lua, both nil
and false make a condition
false; any other value makes it
All numbers are real numbers; there
is no distinction between integers
and floating-point numbers.
Hexadecimal and binary values are
also handled as the number type in
characters
Functions perform a task or compute
and return values.
New tables are created with { }
braces. For example,
{1, 2, 3.00e0}.
Allows arbitrary program data to be
stored in Lua variables.