Applies to: RS3 Scripting Engine 2016 version 1.1 LUA version 5.3 January 2016
Revised December 2017 - version 1.2
RS3 is a scripting language based on LUA (the license is reproduced verbatim below). LUA is a lightweight multi-paradigm
programming language designed primarily for embedded systems and clients. Redtitan use LUA to automate document
production using RedTitan EscapeE and the uberED HTML5/CSS3/SVG1.1authoring systemRedTitan extends LUA by
providing a number of functions that interface to EscapeE automation API. The RS3 application will execute the content
of a script file (default extension .LUA) specified as the first parameter on the command line.
In addition to the functions documented below, RS3 defines the global table cmd . This contains the command line
parameters.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute,
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
This is not a user guide. This reference guide documents the extension made to LUA for RedTitan RS3. The examples use
LUA syntax and data types refer to LUA conventions
Parts of RS3 are based on Lua which is free software distributed under the terms of the MIT license reproduced here
Defaults to the comma character. Note: Inter-field separator may only be
specified as a single character.
Specifies if the first record is treated as a list of field names. Fields from the
CSV file are read as name/value pairs. If this parameter is set to false the first
record will be treated as a data record and fields will be named field1, field2,
field3 etc. Note: Field names (if explicitly specified in the first record) must be
legal LUA identifiers and they are case sensitive,
Return value If the function succeeds an integer handle is returned that may be used in subsequent calls to the function csvrecord to
read data records.
Return value -1 indicates the specified file does not exist or cannot be opened for reading.
Example
See function csvrecord. Version 1.2 (Dec 2017) publishes a class wrapper for CSV functions called TCSV (see
init.LUA, HL.LUA).
e.g.
CSV=TCSV.Create("account-summary1.csv",",",false); -- create an instance of the CSV class
-- The "Record" method of the TCSV class is called using the ":" operator
Fields=CSV:Record()
Reads and parses a CSV record as a LUA table from a file previuosly opened with function csvopen.
Syntax
csvrecord(handle:number):table
Parameters
handle
required
File handle obtained from csvopen call.
Return value The function returns a LUA table consisting on name/value assignments. If there are no further records in the file (EOF) a
LUA nil value is returned
--[[ Publish the contents of a CSV file using an HTML template.
--]]
csvhandle = csvopen("pete.CSV")
if csvhandle==-1 then
print("Error reading CSV file")
return
end
repeat
fields = csvrecord(csvhandle)
if not html("pete.html",fields,"tiger") then break end
until fields==nil
Function pause
Applies to: RS3 Scripting Engine 2016 version 1.1
Display a message dialogue with an optional timeout.
Syntax
pause(message:string[,timeout:number=0]):number
Parameters
message
timeout
required
optional
Message to be displayed
Default - no timeout. i.e. wait for the user to click the OK button. If the
timeout parameter is used the dialogue will be automatically closed after the
period specified in milliseconds.