Keithley 2651A Reference Manual page 273

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

Advertisement

Model 2651A High Power System SourceMeter® Instrument Reference Manual
Example: Break with infinite loop
a, b = 0, 1
while true do
print(a,b)
a, b = b, a + b
if a > 500 then
break
end
end
Tables and arrays
Lua makes extensive use of the data type table, which is a flexible array-like data type. Table indices
start with 1. Tables can be indexed not only with numbers, but with any value (except nil). Tables
can be heterogeneous, which means that they can contain values of all types (except nil).
Tables are the sole data structuring mechanism in Lua; they may be used to represent ordinary
arrays, symbol tables, sets, records, graphs, trees, and so on. To represent records, Lua uses the
field name as an index. The language supports this representation by providing a.name as an easier
way to express a["name"].
2651A-901-01 Rev. A / March 2011
Section 6: Instrument programming
This example uses a break statement
that causes the while loop to exit if the
value of a becomes greater than 500.
Output:
0.00000e+00
1.00000e+00
1.00000e+00
1.00000e+00
1.00000e+00
2.00000e+00
2.00000e+00
3.00000e+00
3.00000e+00
5.00000e+00
5.00000e+00
8.00000e+00
8.00000e+00
1.30000e+01
1.30000e+01
2.10000e+01
2.10000e+01
3.40000e+01
3.40000e+01
5.50000e+01
5.50000e+01
8.90000e+01
8.90000e+01
1.44000e+02
1.44000e+02
2.33000e+02
2.33000e+02
3.77000e+02
3.77000e+02
6.10000e+02
6-29

Advertisement

Table of Contents
loading

Table of Contents