User manual

Series 3700 System Switch/Multimeter Reference Manual Section 9: Files
3700S-901-01 Rev. C / July 2008 9-3
File I/O
Lua supports file I/O with its io library commands. A subset of these commands
is supported for use with Series 3700 instruments. As with Lua FS, these
commands are encapsulated as an io logical instrument so that the files on any
given node are accessible to the entire TSP-Link
TM
system.
Lua organizes its file I/O commands into two groups:
Commands that reside in the io table, for example: io.open, io.close,
io.input, and io.output. These commands are responsible for opening
and closing file descriptors and performing basic I/O operations on a pair of
default files, one input and one output.
Commands that reside in the file descriptors themselves, for example:
file:seek, file:write, and file:read. These commands operate
exclusively on the file with which they are associated.
NOTE File descriptor commands for file I/O use a colon (:) to separate the
command parts rather than a period (.) like the io commands.
A file descriptor (similar to a reading buffer) can only be used with the logical
instrument that created it. Therefore, file descriptors cannot be passed between
nodes in a TSP-Link system.
The default input and output files mentioned above allow for the execution of
many file I/O operations without any reference to a file descriptor. Remote
access to the io.open command is not allowed.
The following Lua I/O commands, which support basic file I/O, are included for
your reference:
file:close() (on page 9-10)
file:flush() (on page 9-10)
file:read() (on page 9-10)
file:seek() (on page 9-11)
file:write() (on page 9-11)
io.close() (on page 9-12)
io.flush() (on page 9-12)
io:input() (on page 9-12)
io:open() (on page 9-13)
io:output() (on page 9-13)
io:read() (on page 9-13)
io:write() (on page 9-14)