![background image](http://html2.mh-extra.com/html/keithley/2657a/2657a_reference-manual_4007750260.webp)
Model 2657A High Power System SourceMeter® Instrument Reference Manual
Section 6: Instrument programming
2657A-901-01 Rev. B/December 2012
6-11
What is Lua?
Lua is a programming language that can be used with TSP-enabled instruments. Lua is an efficient
language with simple syntax that is easy to learn.
Lua is also a scripting language, which means that scripts are compiled and run when they are sent
to the instrument. You do not compile them before sending them to the instrument.
Lua basics
This section contains the basics about the Lua programming language to allow you to start adding
Lua programming commands to your scripts quickly.
For more information about Lua, see the
). Another source of useful
informatiohttp://lua-users.org
), created for and by users of Lua programming
language.
Comments
Comments start anywhere outside a string with a double hyphen (--). If the text immediately after a
double hyphen (--) is anything other than double left brackets (
[[
), the comment is a short comment,
which continues only until the end of the line. If double left brackets (
[[
) follow the double hyphen (--),
it is a long comment, which continues until the corresponding double right brackets (
]]
) close the
comment. Long comments may continue for several lines and may contain nested
[[
. . .
]]
pairs.
The table below shows how to use code comments.
Using code comments
Type of
comment
Comment
delimiters
Usage
Example
Short
comment
--
Use when the
comment text is
short enough that it
will not wrap to a
second line.
--Disable the beeper.
beeper.enable = beeper.OFF
Long
comment
--[[ ]]
Use when the
comment text is long
enough that it wraps
to additional lines.
--[[Displays a menu with three menu
items. If the second menu item is
selected, the selection will be
given the value Test2.]]
selection = display.menu(
"Sample Menu", "Test1 Test2 Test3")
print(selection)
Содержание 2657A
Страница 3: ......