2600AS-901-01 Rev. B / September 2008 Return to Section Topics 19-3
Series 2600A System SourceMeter® Instruments Reference Manual Section 19: Remote Commands
Test Script Language (TSL)
Introduction
A script is a program that the Test Script Processor (TSP) executes. A script is written using the
Test Script Language (TSL). TSL is an efficient language, with simple syntax and extensible
semantics. TSL is an implementation of the Lua programming language, Copyright
© 1994-2004
Tecgraf, PUC-Rio. See http://www.lua.org, the official website for the Lua Programming Language,
for more information. Also, http://lua-users.org internet site is created for and by users of the Lua
programming language and is another source of useful information.
Reserved words
and function return
elseif nil until
for repeat else
local true false
then do in
break if or
end not while
Variables and types
TSL has six basic types; nil, Boolean, number, string, function, and table. TSL is a dynamically
typed language, which means variables do not need to be declared as a specific type. Instead,
variables assume a type when a value is assigned to them. Therefore, each value carries its own
type. If a variable has not been assigned a value, the variable defaults to the type nil. All numbers
are real numbers. There is no distinction between integers and floating-point numbers in TSL.
-- var is nil.
var = nil
-- var is now a number.
var = 1.0
-- var is still a number.
var = 0.3E-12
-- var is still a number.
var = 7
-- var is now a string.
var = "Hello world!"
-- var is still a string.
var = "I said, Hello world!"
-- var is now a function that adds two numbers.
var = function(a, b) return(a+b) end
-- var is now a table (array) with three initialized members.
var = {1, 2., 3.00e0}
Nil is a type with a single value, nil, whose main property is to be different from any other value.
Global variables have a
nil value by default—before a first assignment—and you can assign nil
to a global variable to delete it. TSL uses
nil as a kind of non-value to represent the absence of
a useful value.