Keithley 2651A Reference Manual page 266

High power system sourcemeter instrument
Hide thumbs Also See for 2651A:
Table of Contents

Advertisement

Section 6: Instrument programming
Logical operators
The logical operators in Lua are and, or, and not. All logical operators consider both false and
nil as false and anything else as true.
The operator not always returns false or true.
The conjunction operator and returns its first argument if this value is false or nil; otherwise, and
returns its second argument. The disjunction operator or returns its first argument if this value is
different from nil and false; otherwise, or returns its second argument. Both the and and the or
logical operators use shortcut evaluation, that is, the second operand is evaluated only if necessary.
Example
print(10 or errorqueue.next())
print(nil or "a")
print(nil and 10)
print(false and errorqueue.next())
print(false and nil)
print(false or nil)
print(10 and 20)
String concatenation
String operators
Operator
Description
Concatenates two strings. If both operands are strings or number, they are converted
..
to strings according to Lua coercion rules, as follows:
Example: Concatenation
print(2 .. 3)
print("Hello " .. "World")
Operator precedence
Operator precedence in Lua follows the order below (from higher to lower priority).
6-22
Model 2651A High Power System SourceMeter® Instrument Reference Manual
Any arithmetic operation applied to a string tries to convert that string to a number,
following the usual rules.
Whenever a number is used where a string is expected, the number is converted to a
string, in a reasonable format.
1.00000e+01
a
nil
false
false
nil
2.00000e+01
23
Hello World
2651A-901-01 Rev. A / March 2011

Advertisement

Table of Contents
loading

Table of Contents