cc-haxe/src/polyfill.lua

23 lines
659 B
Lua

-- Polyfill require function
_G.require = function (module)
-- Polyfill luv package
if module == "luv" then
local module = {}
local metatable = {
__index = function(t, i)
-- Polyfill gettimeofday
if i == "gettimeofday" then
return function ()
local mil = os.epoch()
return mil / 1000, mil
end
else
print("ERROR: Tell a dev to implement: " .. i)
end
end
}
setmetatable(module, metatable)
return module
end
end