452.0 Getting Started2.10 Link*One Scripting2.10.1 OverviewLink*One has an embedded script language called Lua. When Link*Onereceives data from a device, a hot key is pressed etc. certain methods inthe script are called. The code in these scripts determines what actionis taken.The name of the script file is Script.txt and is placed in the Link*Oneapplication data folder. The location of this folder varies depending onwhat operating system you are using. If you need to make a backup ofthe script or copy it to another PC, click on the Browse Script Folder...on the Misc tab in the Settings dialog. Windows Explorer is opened anddisplays the contents of the script folder.When you edit the script, remember to restart Link*One to recompilethe script or use the faster alternative of entering the Settings dialog andthen exiting it.If you make a mistake, for example create a syntax error, an error mes-sage is displayed when the script is compiled:Also, some errors can appear when the script is running, so called run-time errors. Here are a couple of examples:2.10.2 Lua LanguageFrom http://www.lua.org/about.html:Lua is a powerful, fast, light-weight, embeddable scripting language.Lua combines simple procedural syntax with powerful data descriptionconstructs based on associative arrays and extensible semantics.Put simply, Lua is what makes data processing in Link*One very flexibleand powerful. The reference manual for Lua can be found at the Lua site:http://www.lua.org/There is also a printed book on the Lua language, called Programmingin Lua, which is more accessible than the reference manual.Apart from Lua and its built-in language, Link*One exposes a numberof useful methods to the script.2.10.3 Script EventsWhen things happen in Link*One, for example a hot key or a data stringis received on the serial port, an event is generated. This results in ascript method being called. The methods called when events happen arecalled event methods.The table below is an overview and short description of all the differ-ent event methods. For a more detailed explanation, see the topic EventMethods below.Event Handler When CalledonStart Link*One is startedonEnd Link*One is exitedonData A data string is received on the serial portonHotKey A hot key is pressedonKeyboardCapture A data string is received from a HID deviceonExternalData A data string is received from an externalapplicationonTimer The timer interval has elapsedonCTS Status change on CTSonDSR Status change on DTRonRI Status change on RIonDCD Status change on DCD2.10.4 Event MethodsIn this topic all the event methods are explained in detail.2.10.4.1 onStart()This method is called when Link*One is started. It is also called whenyou exit the Settings dialog.This method receives no arguments.Example: Beep on start2.10.4.2 onEnd()Called when Link*One is exited. It is also called when you enter theSettings dialog.This method receives no arguments.Example: Beep on exit2.10.4.3 onData(data, length)Called when a data string is received from the serial port.This method receives the data string in data and the length of the stringin length.Data may contain binary characters including the null character.Please note that if the Data String Termination is set to be a charac-ter and that character does not match the terminator used by the serialdevice, this method is never called.