Per a recent Lua mailing list thread, I went through to make sure the code herein is thread safe. It is. Also, while I was here, I decided to update the code to my current coding standards.