In that case, I recommend the "keys" function from Steve's
Microlight library.
xpairs is a wonderfully clever piece of code. Though the more I think about it, the more nervous it makes me. Even in cases without __newindex or __index metamethods, errors have a chance of leaving the table in an awkward state. Steve's explicit proxy is safer, if less convenient.