Using the Lua C API, I registered a simple `Object` class to Lua, like this:

```
// My C++ Object class
class Object {
private:
    double x;
public:
    Object(double x) : x(x){}
};

// Create and return instance of Object class to Lua
int object_new(lua_State* L)
{
    double x = luaL_checknumber(L, 1);
    *reinterpret_cast<Object**>(lua_newuserdata(L, sizeof(Object*))) = new Object(x);
    luaL_setmetatable(L, "Object");
    return 1;
}

// Functions to register to Lua
const luaL_Reg functions[] =
{
    {"new", object_new},
    {nullptr, nullptr}
};

// Register the Object class to Lua
luaL_newmetatable(L, "Object");
luaL_setfuncs(L, functions, 0);
lua_pushvalue(L, -1);
lua_setfield(L, -2, "__index");

```

In my Lua script, the following works just fine:

```
// Works!
my_object = Object.new(42)

```

But, I would like to be able to do this (i.e. omit the `.new` part):

```
// Fail :(
my_object = Object(42)

```

But when I execute the Lua script, I get this error:

```
...attempt to call a table value (global 'Object').

```

Is there a way to register a C++ class in a way that the constructor gets called if we don't provide a function name? What did I miss to make this work? That would be particularly useful for temporary objects.

Thanks!