added tinker_core as lib

This commit is contained in:
2022-02-20 20:29:04 +01:00
parent fc98520147
commit 7b33667e04
4 changed files with 40 additions and 9 deletions

22
src/polyfill.lua Normal file
View File

@@ -0,0 +1,22 @@
-- 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