Luatable is a small library that aids in the usage of Lua as a data description language.

It supports only the very basics of the Lua language. No extra libraries are loaded during the state initialization, which means no messing around with os.system().


Luatable's API is designed to be very intuitive.

Creating a table from C++

Luatable::Value table;
//    Automatic type deduction with implicit constructors
table["number"] = 42;
table["string"] = "I'm a string!";
table["nested"]["boolean"] = false;
//    Array creation via initializer lists
table["array"] = {"foo", false, 13.37, {"nested"} };

This code produces the following Lua code:

array = {
nested = {
    boolean = false
number = 42
string = "I'm a string!"

Loading a file, displaying it, and saving it again

Luatable::Value document;

std::cout << document;


Type conversion and lexical casting

Luatable::Value val = "100";
int oneHundred = val.asInt();


Copyright (c) 2012 Jacob Albano

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.

  2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.

  3. This notice may not be removed or altered from any source distribution.