Section 2
:
TSP Programming Fundamentals
Series 3700 System Switch/Multimeter Reference Manual
2-4
Document Number: 3700S-901-01 Rev. A / August 2007
Named script key points:
Different script names may be created using
loadscript
.
A new script is sent with the same name will overwrite (replace) previous versions.
Sending new scripts with different names will not remove previously sent scripts.
Using named scripts, any number of scripts can be made available simultaneously within
the limits of the memory available to the run-time environment.
Named scripts are stored as global variables in the run-time environment, therefore, like
all other global variables, they are lost when the unit is powered off.
Nonvolatile storage can be used to store downloaded scripts across power cycles. See
Saving a user script later in this section for more information.
Programming overview
Chunk defined
A chunk is a single programming statement or a sequence of statements that are executed
sequentially (passed to Lua as a single line). There are non-scripted chunks and scripted
chunks.
Single statement chunk
The following programming statement is a chunk:
print ("This is a chunk")
When the above chunk is executed, it returns the following string:
This is a chunk
Multiple chunks
A chunk can also contain multiple statements. Each statement in the line of code must be
separated by whitespace. The following chunk contains two statements:
print ("This is a chunk") print ("that has two statements")
When the above chunk is executed, the two statements are executed sequentially, and the
following strings are returned:
This is a chunk
that has two statements
Multiple chunks
Each of the following lines of code is a separate chunk. The first chunk sets the ASCII precision
to 10 for reading. The second chunk turns on ASCII readings.