Lua Modules

A number of Lua modules are included with Aegisub. Some of these, such as karaskel.lua 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 ''.

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

An assorted collection of various utility functions which don’t fit into any coherent categories, especially for handling colours.
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.
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.
A function to clean up ASS tags in a line.
Functions for copying and pasting text.
Bindings for ICU regular expressions via boost.regex, which has full Unicode support and more features than Lua’s built in regular expression.
PEG library for writing parsers.
A serialization library for saving tables to extradata or config files
Some assorted filesystem functionality not supported by the Lua standard library.