Sample Lua Programs
Primer
It is highly recommended that the lua programming manuals be studied to understand the syntax and structure of lua programs. To assist, the following are some pointers based on a beginner's experience in programming in lua for eccoext:
- there is no error trapping or reporting, if the code fails generally nothing happens and there is no feedback given as to the reason for the failure;
- a typical error can be the omission of the "then" as part of the "if" statement or similar typographical errors;
- take care to distinguish between the lua code contained in rules and programs. The program uses the lua 5.1 code whereas the rules use the slang interpretation of lua;
- some of these samples are written as eccoext rules and others as functions. The only difference is that the functions start with a name and end in a corresponding 'end'. To change the scripts simply add the function name and the closing end statement: it is a common mistake to leave off the closing end statement.
Most programs may be tested using the eccoext evaluator prior to implementing it into a function. The evaluator is very useful for debugging of sections of code to activate in eccoext use CTRL ALT K.
Page Explanation
This page is dedicated to eccoext Lua programming examples developed by users. Each sample program links to a new page where the details of the program are presented. The last sample is empty for the benefit of anyone who wishes to add to the samples, simply click on it to take you to a fresh page and then edit the new page. To edit a page you will need to be registered with this site and will have to be logged on. And please, if you do add to the samples put a link to the next sample program empty page for the next person.
Sample Program 1
A program to extract the item text from selected records in the ecco file and save to a CSV file.
Sample Program 2
A program to count the words and characters of selected items
Sample Program 3
A sample program to extract data from folders and concatenate the information to the item text and then write the result back to the item text.
Sample Program 4
A script that will automatically assign multiple dependancies when more than one item is selected.
Sample Program 5
Extraction of depends items and displaying of the depends references.
Sample Program 6
Awaiting Creation.