Closed timotheeg closed 3 years ago
You're right, toBits, makeFrame and also playfield.getBinaryString are the parts of the code that I need to change. It was mostly a case of "it's fast enough so I'll leave it for now". I don't have any experience working with bits in Lua.
All 3 emulators use Lua 5.1, which I don't think supports these bit operators:
Oh damn that's sad 😓 And yeah, it looks like these were introduced in Lua 5.3, I should have checked earlier.
Ignore till Lua gets an upgrade then. I'll just close the PR.
I don't know what I'm doing in lua 😅 , but
util.lua
looked like it could use some TLC, so here's a small change to just thetoBits()
method for a start. If it works, I might try to do more inmakeFrame()
too.PR assumes that lua uses a consistent bit representation for integers like javascript (seems to work on OSX Lua CLI 5.4.3, but I have not tested in any of the emulators cough)
I also didn't do a speed comparison test (I just assume using bitwise operators are faster 😑).
Ref: https://www.lua.org/manual/5.3/manual.html#3.4.2