2022-03-27 03:54:02 +02:00
|
|
|
local function areaOverlap(x, y, areaX, areaY, areaW, areaH)
|
|
|
|
return x > areaX and y > areaY and x < areaX + areaW and y < areaY + areaH
|
|
|
|
end
|
|
|
|
|
2022-04-11 18:47:26 +02:00
|
|
|
--modulo operation for index value
|
|
|
|
local function modIndex(index, mod)
|
|
|
|
return (index - 1) % mod + 1
|
|
|
|
end
|
|
|
|
|
2022-04-27 02:03:42 +02:00
|
|
|
local function firstAlphaNum(s)
|
|
|
|
for i = 1, string.len(s) do
|
|
|
|
local byte = string.byte(s, i);
|
|
|
|
if ((byte >= 65 and byte <= 90) or (byte >= 97 and byte <= 122) or (byte >= 48 and byte <= 57)) then
|
|
|
|
return string.sub(s, i, i);
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
return '';
|
|
|
|
end
|
|
|
|
|
2021-11-20 22:43:11 +01:00
|
|
|
return {
|
2022-04-03 23:24:17 +02:00
|
|
|
areaOverlap = areaOverlap,
|
2022-04-11 18:47:26 +02:00
|
|
|
modIndex = modIndex,
|
2022-04-27 02:03:42 +02:00
|
|
|
firstAlphaNum = firstAlphaNum,
|
|
|
|
}
|