Skip to content

Instantly share code, notes, and snippets.

View Hex.lua
local Hex = {}
-- math dealing with the hex grid, using axial coords
-- Y
-- /_ X
-- note that, for all hexes, x + y + z = 0
Hex.__index = function(t,k)
if k == 'z' then
return -t.x - t.y