Ver código fonte

[lua] adjust the checks for bit/bit32

Justin Donaldson 6 anos atrás
pai
commit
4fae95610d
1 arquivos alterados com 2 adições e 2 exclusões
  1. 2 2
      src/generators/genlua.ml

+ 2 - 2
src/generators/genlua.ml

@@ -2041,8 +2041,8 @@ let generate com =
         println ctx "pcall(require, 'bit')"; (* require this for lua 5.1 *)
         println ctx "if bit then";
         println ctx "  _hx_bit = bit";
-        println ctx "elseif bit32 then";
-        println ctx "  local _hx_bit_raw = bit32";
+        println ctx "else";
+        println ctx "  local _hx_bit_raw = _G.require('bit32')";
         println ctx "  _hx_bit = setmetatable({}, { __index = _hx_bit_raw });";
         println ctx "  _hx_bit.bnot = function(...) return _hx_bit_clamp(_hx_bit_raw.bnot(...)) end;"; (* lua 5.2  weirdness *)
         println ctx "  _hx_bit.bxor = function(...) return _hx_bit_clamp(_hx_bit_raw.bxor(...)) end;"; (* lua 5.2  weirdness *)