I've just noticed a strange issue with garbage collection in my Lua code.
The code is quite large, would be difficult to create a test case, but the
basics are:
1) Create a userdata object
2) Store it as a key in a table in the registry
3) Create more objects
4) Close the Lua state
5) The object created in step 1 is collected and its __gc is called
6) Other objects' __gc look in the table in the registry, and that object
is still there!
How can __gc be called and the object not be removed from the table?