Modules

A number of Lua modules are included with Aegisub. Some of these, such as Karaskel implement subtitle-specific functionality, while others such as Re fill holes in the Lua standard library.

Using modules

Simply write modulename = require 'aegisub.modulename' at the top level of a script. For example, to include the Re modules, re = require 'aegisub.re'.

Note that if you look at older scripts you will probably see several other methods for including modules, such as include. These have been deprecated in favor of following the modern lua module style introduced with Lua 5.2.

To use modules in Karaoke Templater, place the require statement in a code once line. Note that karaskel.lua, utils.lua and unicode.lua do not have to be required in Karaoke Templater, as they are automatically imported.

Modules reference

Util
An assorted collection of various utility functions which don't fit into any coherent categories, especially for handling colours.
Karaskel
The karaoke skeleton is a collection of functions mainly intended to do text layout of timed karaoke for creating advanced karaoke effects, as well as a number of other helper functions.
Unicode
All data passed in and out of Aegisub through the Automation 4 Lua interface are encoded in UTF-8, but Lua doesn't natively provide support for this. Several helper functions are provided here.
Cleantags
A function to clean up ASS tags in a line.
Clipboard
Functions for copying and pasting text.
Re
Bindings for ICU regular expressions via boost.regex, which has full Unicode support and more features than Lua's built in regular expression.
lpeg
PEG library for writing parsers.
luabins
A serialization library for saving tables to extradata or config files
lfs
Some assorted filesystem functionality not supported by the Lua standard library.