Section 14: Instrument programming
When calling the function, you must specify a string for the name argument of the function. For
example, to set the name to John, call the function as follows:
myDisplay("John")
Example: User script
User script created in Test Script Builder or
TSB Embedded
function myDisplay(name)
display.clear()
display.settext(
name .. "$N is here!")
end
Operators
You can compare and manipulate Lua variables and constants using operators.
Arithmetic operators
Operator
Description
+
addition
-
subtraction
*
multiplication
/
division
-
negation (for example, c = −a)
^
exponentiation
Relational operators
Operator
Description
<
less than
>
greater than
<=
less than or equal
>=
greater than or equal
~=
not equal
==
equal
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 the first argument 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 and and
or use shortcut evaluation, that is, the second operand is evaluated only if necessary.
14-20
Model 2606B System SourceMeter® Instrument Reference Manual
User script created in a different program
loadscript
function myDisplay(name)
display.clear()
display.settext(
name .. " $N is here!")
end
endscript
2606B-901-01 Rev. C November 2021
Need help?
Do you have a question about the KEITHLEY SourceMeter 2606B and is the answer not in the manual?