20 August 2019 Link

LuaXML is a XML API for Lua supplied with Lua for Windows although it is available for Linux also. It is written partly in C as a DLL and partly in Lua.

Using it

local xfile = xml.load("xmlfile.xml")

XML Object

It is a table with numerical keys:
key 0 contains string for the name of the element
key 1 contains the 1st child
key 2 contains the second child and so on

For simple elements with just a value the Key 1 is the Text element i.e. the first child.

Table also contains alphanumeric keys if the element has attributes
key is the name of the attribute and its value is the value of the attribute.

Object Identifier

The XML object is recognized by the print statement (after loading luaXML of course) and the LuaXML routines by a metatable that is associated with each XML object.

A simple table in the LuaXML syntax can be made an XML object by associating the same metatable:
or by using the API function:
mytable =


  1. Project Page

See Also

  1. Lua Language