cc-tweaked / Cobalt

A re-entrant fork of LuaJ
Other
72 stars 13 forks source link

Add string.pack, string.packsize, string.unpack from Lua 5.3 #43

Closed MCJack123 closed 4 years ago

MCJack123 commented 4 years ago

This PR adds three new functions from Lua 5.3:

This passes the Lua 5.3.4 tests for the functions, with a few adjustments made regarding number sizes due to differences in Lua 5.1 & Java. I have included these tests in the PR as well.

The code is a bit messy right now and may need some refactoring to look decent, but it works.

MCJack123 commented 4 years ago

Oops, forgot to apply the endianness/alignment changes everywhere. This is now fixed. I also switched unpack to use ArrayLists.