Hi and welcome to the forums!
So, some constructive feedback, i hope:
- Local variables are a good thing to use, but if you clearly use the same locally defined functions in multiple files, think about putting them into their own lua file, and requiring that in the others to avoid code duplication. (like gDraw)
- Löve uses LuaJIT by default, which means it has its own bitops library you can require in with something like local bit = require 'bit'; LuaJIT's own website has a section on how that works.
- LuaJIT also optimizes 0th indices so you don't necessarily need to use 1-indexed tables... that said, there are downsides, as in, many functions that work on the "sequence" part of tables would disregard the 0th elements, like ipairs (a moot point since most of your for loops are simple numeric ones), or # would return one less than you'd expect. In any case there's no real performance gain/loss with either method, just wanted to mention it since you did write comments regarding lua's 1-based indexing in your source.
Bonus points for trying to make it compatible with multiple löve versions though.