Hi thanks for the replies. I've just implemented a solution based on Rici code. The problem was simpler than is seemed. I just had to add the "__typename" field in every metatable created. Then, in the methods where I need to check the datatype, I just push the field __typename and read it.
Thanks again for the help.
> It looks like in lua 5.0.2, luaL_newmetatable put two entries in the > registry, one to map the tname to the metadata, and the other to map > the > metadata to the tname. So this would be easier if you aren't using
Well, that's true enough but lauxlib is not really part of core Lua.
Even if you can't control the creation of metatables, you can certainly get at them with luaL_newmetatable, so as long as you have a list of
the types you're interested in (which seems a reasonable assumption), you can do something like this: