thornWM/lib/util.lua
2025-05-23 15:41:23 +00:00

17 lines
319 B
Lua

local Util = {}
function Util.indexOf(haystack, needle)
for b,blade in pairs(haystack) do
if blade == needle then return b end
end
end
function Util.getNext(stack, item, d)
local w = Util.indexOf(stack, item)
if not w then return nil end
local i = (((w-1) + d) % #stack) + 1
return stack[i]
end
return Util