Ipelib: Programming in Lua

Ipelib

Programming in Lua

The library libipelua implements Lua bindings for many classes in Ipelib. The bindings are available in Lua ipelets, as well as in Lua scripts executed using the ipescript program.

These pages document the Lua bindings to Ipelib:

- Lua bindings for geometric objects
- Lua bindings for objects and attributes
- Lua bindings for Document, Page, and StyleSheet

When writing Ipelets in Lua, you have access to additional methods provided by the Ipe program itself:

- Lua bindings for Ipe
- Lua bindings for dialogs and menus

# Examples

Here is a Lua script that reads an Ipe document and then recenters each page on the paper. You can run this script as "ipescript recenter".

The following script prints out all the gradients defined in a document:

And here is a script that shows how to add a gradient to a document (the same technique works for tilings and effects):

For more examples, have a look at the scripts in your Ipe installation, such as add-style.lua or update-styles.lua.