I appreciate the suggestion about using chars to pack in bytes of data, I’ve already tried that and unfortunately it did not work because when you create a new string in Lua, a decent amount of extra memory is also reserved (for some reason). I did a benchmark where I stored 16 bit numbers in the regular number format, versus storing them in 2 char long strings (16 bits), and the numbers used up substantially less memory. I believe I’ve even done a test where I store all of my numbers into one giant string; same thing.
[Note that when I say 16 bit number, I mean values that can be represented in 16 bits. Of course, I don’t have the ability to store a number in 16 bits, so these “16 bit numbers” are being stored in the typical 64 bits.]