-- 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) error("ERROR: Tell a dev to implement: " .. i) end end } setmetatable(module, metatable) return module end print("ERROR: Tell a dev to implement: " .. module) error("ERROR: Tell a dev to implement: " .. module) end -- Polyfill bit. see: http://bitop.luajit.org/api.html -- Already implemented -- bit.band -- bit.bnot -- bit.bor -- bit.bxor -- bit.tobit = function(x) print("ERROR: Tell a dev to implement: bit.tobi") error() end bit.tohex = function(x,n) print("ERROR: Tell a dev to implement: bit.tohex") error() end bit.lshift = function(x,n) print("ERROR: Tell a dev to implement: bit.lshift") error() end bit.rshift = function(x,n) print("ERROR: Tell a dev to implement: bit.rshift") error() end bit.arshift = function(x,n) -- TODO: this seems to easy. return bit.brshift(x,n) end bit.rol = function(x,n) print("ERROR: Tell a dev to implement: bit.rol") error() end bit.ror = function(x,n) print("ERROR: Tell a dev to implement: bit.ror") error() end bit.bswap = function(x) print("ERROR: Tell a dev to implement: bit.bswap") error() end