Use luaL_setmetatable and add a fallback implementation to compat.h