Section 6: Instrument programming Model 2657A High Power System SourceMeter® Instrument Reference Manual
6-12 2657A-901-01 Rev. B/December 2012
Function and variable name restrictions
You cannot use factory script names, functions created by factory scripts, Lua reserved words and
top level command names for function or variable names.
For information on factory script names, see Factory scripts
(on page 5-18).
You cannot use the following Lua reserved words for function or variable names.
Lua reserved words
and for or
break function repeat
do if return
else in then
elseif local true
end nil until
false not while
You also cannot use top-level command names as variable names. If you use these names, it will
result in the loss of use of the commands. For example, if you send the command digio = 5, you
cannot access the digio.* commands until you turn the instrument power off and then turn it on
again. These names include:
Top level command names
beeper gcinfo os status
bit gettimezone print string
collectgarbage gpib printbuffer timer
dataqueue io printnumber tonumber
delay lan reset tostring
digio localnode savebuffer trigger
display makegetter script tsplink
errorqueue makesetter serial tspnet
eventlog math settime type
exit meminfo settimezone userstring
format node setup waitcomplete
fs opc smua
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.