Keithley 2450 Reference Manual page 507

Interactive sourcemeter instrument
Table of Contents

Advertisement

Section 7: Introduction to TSP operation
Example 1
print(10 or eventlog.next())
print(nil or "a")
print(nil and 10)
print(false and eventlog.next())
print(false and nil)
print(false or nil)
print(10 and 20)
Example 2
hex = function (i) return "0x"..string.format("%X", i) end
print(hex(0x54 | 0x55))
print(hex(0x54 & 0x66))
Set the format to return hexadecimal values, then OR two hexadecimal values and AND two
hexadecimal values.
Output:
0x55
0x44
Example 3
hex = function (i) return "0x"..string.format("%X", i) end
a, b= 0b01010100, 0b01100110
print(hex(a), "&", hex(b), "=", hex(a & b))
Set the format to return hexadecimal values, define binary values for a and b, then AND a and b.
Output:
0x54 & 0x66 = 0x44
String concatenation
String operators
Operator
Description
..
Concatenates two strings. If either argument is a number, it is coerced to a string (in
a reasonable format) before concatenation.
Example: Concatenation
print(2 .. 3)
print("Hello " .. "World")
7-16
Model 2450 Interactive SourceMeter® Instrument Reference Manual
10
a
nil
false
false
nil
20
23
Hello World
2450-901-01 Rev. B/September 2013

Advertisement

Table of Contents
loading

Table of Contents