isaacscript-common 5.1.1 → 5.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,8 @@
1
1
  local ____lualib = require("lualib_bundle")
2
2
  local __TS__ParseInt = ____lualib.__TS__ParseInt
3
- local __TS__ArrayUnshift = ____lualib.__TS__ArrayUnshift
3
+ local __TS__NumberToString = ____lualib.__TS__NumberToString
4
4
  local __TS__Iterator = ____lualib.__TS__Iterator
5
+ local __TS__ArrayUnshift = ____lualib.__TS__ArrayUnshift
5
6
  local ____exports = {}
6
7
  local ____flag = require("functions.flag")
7
8
  local addFlag = ____flag.addFlag
@@ -27,11 +28,13 @@ end
27
28
  -- any padding).
28
29
  function ____exports.convertDecimalToBinary(self, number, minLength)
29
30
  local bits = {}
30
- local i = 0
31
- while number > 0 do
32
- bits[i + 1] = number % 2
33
- number = math.floor(number / 2)
34
- i = i + 1
31
+ local bitsString = __TS__NumberToString(number, 2)
32
+ for ____, bitString in __TS__Iterator(bitsString) do
33
+ local bit = tonumber(bitString)
34
+ if bit == nil then
35
+ error("Failed to convert the following number to binary: " .. tostring(number))
36
+ end
37
+ bits[#bits + 1] = bit
35
38
  end
36
39
  if minLength ~= nil then
37
40
  while #bits < minLength do
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "5.1.1",
3
+ "version": "5.1.2",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",