Yes, that sounds like a genius idea! It took me awhile to think through all
the implications. IIUC, the OP could just generate a single unique metatable
for each full userdata object he wants to clone. He stores a reference to
the full userdata object in the metatable; the lightuserdata value becomes
the index into the full userdata (or some other object it references).
At first, I like this idea :)
If we don't care the lightuserdata's life time , we can share the unique metatable for each full userdata type .
Put a weak table into metatable to reference all the live userdata for safe. When we need access lightuserdata , check the table first to verify whether the userdata it refer to is still alive.