Model 2461 Interactive SourceMeter® Instrument Reference Manual Section 7: Introduction to TSP operation2461-901-01 A/November 2015 7-25Tables and arraysLua makes extensive use of the data type table, which is a flexible array-like data type. Table indicesstart with 1. Tables can be indexed not only with numbers, but with any value except nil. Tables canbe 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 ordinaryarrays, symbol tables, sets, records, graphs, trees, and so on. To represent records, Lua uses thefield name as an index. The language supports this representation by providing a.name as an easierway to express a["name"].The output you get from this example may vary depending on the data format settings of theinstrument.Example: Loop arrayatable = {1, 2, 3, 4}i = 1while atable[i] doprint(atable[i])i = i + 1endDefines a table with four numeric elements.Loops through the array and prints eachelement.The Boolean value of atable[index]evaluates to true if there is an element at thatindex. If there is no element at that index, nil isreturned (nil is considered to be false).Output:1234Standard librariesIn addition to the standard programming constructs described in this document, Lua includesstandard libraries that contain useful functions for string manipulation, mathematics, and relatedfunctions. Test Script Processor (TSP® ) scripting engine instruments also include instrument controlextension libraries, which provide programming interfaces to the instrumentation that can beaccessed by the TSP scripting engine. These libraries are automatically loaded when the TSPscripting engine starts and do not need to be managed by the programmer.The following topics provide information on some of the basic Lua standard libraries. For additionalinformation, see the Lua website (http://www.lua.org).When referring to the Lua website, please be aware that the TSP scripting engine uses Lua 5.0.2.