local Util = {} function Util.toHexChar(v) return ("0123456789ABCDEF"):sub(v, v) end function Util.fromHexChar(c) local index = ({("0123456789ABCDEF"):find(c)})[1] if index ~= nil then return index - 1 end return nil end function Util.boundCheck(x, y, w, h) if x < 1 or x > w or y < 1 or y > h then error(("Index out of range: (%d %d) is not within ([1,%d], [1,%d])"):format(x, y, w, h)) end end return Util