a safe XML generator for Lua


This is a simple Lua binding for Tim Bray's Genx library. Genx is a simple, fast, and safe generator for XML written in C. It is guaranteed to produce well-formed XML.

This Lua binding is free software and uses the same license as Lua 5.1. It includes the Genx source, which uses a similar license.


The latest version is 0.5.0, which includes Genx Beta 5. Version 0.5.0 is not yet a complete binding for Genx, but it provides a useful segment of its functionality. For a list of current issues, see the bug tracker.


You can install genx with LuaRocks:

$ luarocks install

Or you can download genx from its LuaForge page. You can also get a current snapshot of the source or clone it with Mercurial:

$ hg clone


0.5.0, August 14, 2009
  • First public release, based on Genx Beta 5
  • Includes elements, attributes, text, and comments only


This module was developed by Adrian Sampson.

Genx was developed by Tim Bray.

Related Work

There aren't many alternatives for XML generation in Lua. Here's what I was able to find:

  • Lua Element Tree uses a Lua table-based form for representing XML documents and can both generate and read XML.

If you know of other projects that should go here, please let me know.


File an issue on the bug tracker. Or email the author.