Unless I'm mistaken, that won't work with Lua 5.1 since the __gc
metamethod for tables was introduced in 5.2.
In this case, it does nothing. You'll need a userdata to achieve the
same effect.
You should take a look at Thijs Schreijer's "Lua Library Template"
https://github.com/Tieske/Lua_library_template
For instance, this example does what you want:
https://github.com/Tieske/Lua_library_template/blob/master/udtype_example/udtype.c#L196
Regards,
Ignacio