hexyz is tower defense game, and a lua library for dealing with hexagonal grids
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
395 B

function math.wrapf(float, range)
return float - range * math.floor(float / range)
end
function math.lerp(v1, v2, t)
return v1 * t + v2 * (1 - t)
end
function table.rchoice(t)
return t[math.floor(math.random() * #t) + 1]
end
function table.find(t, predicate)
for i,v in pairs(t) do
if predicate(v) then
return i,v
end
end
return nil
end