Scripts (Lua)
These pages are for you if you want Tilde to do something it does not do by itself: add a command for the : line, react to new mail or a chat message, run a task every few minutes, or bind a key to a function. Scripts are Lua files in the scripts folder of the Tilde folder, ~/.config/tilde/scripts by default. Tilde runs keybind.lua first (the key bindings), then bars.lua (the top bar and the status line), then init.lua, then whatever init.lua loads with require; it writes a starting keybind.lua, bars.lua and init.lua when they are missing and never changes them afterwards. Run tcli scripts after every edit: it loads the files without connecting any account and shows the errors. In tt, the command :scripting.reload loads them again. The rules of the rules module are on Rules for mail, and the full list of functions is in the Lua API reference. The code is described in the README of the scripting project.
| Page | What it answers |
|---|---|
| Commands | How do I add a command, give it words, show a message and run it from another script? |
| Events | How do I run a function when mail arrives, a chat message comes or a script fails? |
| Bars | How do I put my own items, a clock or the memory in the top bar and the status line? |
| Jobs and timers | How do I run a function once later, every few seconds or every few minutes? |
| Keys from Lua | How do I bind a key to a command or to my own function, and take a binding away? |
| The sandbox and limits | What can a script not do, how long may it run, and how do I get help from my editor? |