forked from LeenkxTeam/LNXSDK
Update
This commit is contained in:
@ -33,8 +33,8 @@ local function _hx_new(prototype)
|
||||
end
|
||||
|
||||
function _hx_field_arr(obj)
|
||||
res = {}
|
||||
idx = 0
|
||||
local res = {}
|
||||
local idx = 0
|
||||
if obj.__fields__ ~= nil then
|
||||
obj = obj.__fields__
|
||||
end
|
||||
|
||||
@ -1,16 +1,21 @@
|
||||
-- require this for lua 5.1
|
||||
pcall(require, 'bit')
|
||||
if bit then
|
||||
_hx_bit_raw = bit
|
||||
_hx_bit = setmetatable({}, { __index = _hx_bit_raw });
|
||||
else
|
||||
_hx_bit_raw = _G.require('bit32')
|
||||
_hx_bit = setmetatable({}, { __index = _hx_bit_raw });
|
||||
local hasBit32, bit32 = pcall(require, 'bit32')
|
||||
if hasBit32 then --if we are on Lua 5.1, bit32 will be the default.
|
||||
_hx_bit_raw = bit32
|
||||
_hx_bit = setmetatable({}, { __index = _hx_bit_raw })
|
||||
-- lua 5.2 weirdness
|
||||
_hx_bit.bnot = function(...) return _hx_bit_clamp(_hx_bit_raw.bnot(...)) end;
|
||||
_hx_bit.bxor = function(...) return _hx_bit_clamp(_hx_bit_raw.bxor(...)) end;
|
||||
_hx_bit.bnot = function(...) return _hx_bit_clamp(_hx_bit_raw.bnot(...)) end
|
||||
_hx_bit.bxor = function(...) return _hx_bit_clamp(_hx_bit_raw.bxor(...)) end
|
||||
else
|
||||
--If we do not have bit32, fallback to 'bit'
|
||||
local hasBit, bit = pcall(require, 'bit')
|
||||
if not hasBit then
|
||||
error("Failed to load bit or bit32")
|
||||
end
|
||||
_hx_bit_raw = bit
|
||||
_hx_bit = setmetatable({}, { __index = _hx_bit_raw })
|
||||
end
|
||||
|
||||
-- see https://github.com/HaxeFoundation/haxe/issues/8849
|
||||
_hx_bit.bor = function(...) return _hx_bit_clamp(_hx_bit_raw.bor(...)) end;
|
||||
_hx_bit.band = function(...) return _hx_bit_clamp(_hx_bit_raw.band(...)) end;
|
||||
_hx_bit.arshift = function(...) return _hx_bit_clamp(_hx_bit_raw.arshift(...)) end;
|
||||
_hx_bit.bor = function(...) return _hx_bit_clamp(_hx_bit_raw.bor(...)) end
|
||||
_hx_bit.band = function(...) return _hx_bit_clamp(_hx_bit_raw.band(...)) end
|
||||
_hx_bit.arshift = function(...) return _hx_bit_clamp(_hx_bit_raw.arshift(...)) end
|
||||
|
||||
8
Kha/Tools/windows_x64/std/lua/_lua/_hx_handle_error.lua
Normal file
8
Kha/Tools/windows_x64/std/lua/_lua/_hx_handle_error.lua
Normal file
@ -0,0 +1,8 @@
|
||||
function _hx_handle_error(obj)
|
||||
local message = tostring(obj)
|
||||
if _G.debug and _G.debug.traceback then
|
||||
-- level 2 to skip _hx_handle_error
|
||||
message = _G.debug.traceback(message, 2)
|
||||
end
|
||||
return setmetatable({}, { __tostring = function() return message end })
|
||||
end
|
||||
8
Kha/Tools/windows_x64/std/lua/_lua/_hx_luv.lua
Normal file
8
Kha/Tools/windows_x64/std/lua/_lua/_hx_luv.lua
Normal file
@ -0,0 +1,8 @@
|
||||
if package.loaded.luv then
|
||||
_hx_luv = _G.require("luv");
|
||||
else
|
||||
_hx_luv = {
|
||||
run=function(mode) return false end,
|
||||
loop_alive=function() return false end
|
||||
}
|
||||
end
|
||||
@ -99,16 +99,3 @@ function _hx_tostring(obj, depth)
|
||||
return ""
|
||||
end
|
||||
end
|
||||
|
||||
function _hx_error(obj)
|
||||
if obj.value then
|
||||
_G.print("runtime error:\n " .. _hx_tostring(obj.value));
|
||||
else
|
||||
_G.print("runtime error:\n " .. tostring(obj));
|
||||
end
|
||||
|
||||
if _G.debug and _G.debug.traceback then
|
||||
_G.print(debug.traceback());
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user