c++c++11lualuabind

Luabind-like syntax (index operator)


Currently im experimenting with the Luabind-Library and I stumbled upon its calling syntax. It behaves and works like expected, but somehow I can not understand why or how it does.
The code in question is following:

Class Animation
{
    std::vector frames;
public:
    Animation(){}
    ~Animation(){}
    addFrame(const Texture2D *in_image);
};

//Somewhere else
luabind::module(LuaState)
[
 luabind::class_("Animation")    // < "Animation" how we want to name the Class in the Lua runtime
 .def(luabind::constructor<>())             // < Binds the empty constructor
 .def("addFrame", &Animation::addFrame)     // < Binds the &Animation::addFrame method to lua with the name "addFrame"
];

To be more specific, I don't understand what's happening in the square brackets. Why does this work? I tried to read trough the source code of Luabind, sadly without success. I also tried to reconstruct this behaviour, which was also unsuccessful.
So, am I missing something very obvious?

Thanks in advance!


Solution