Issues:
6RN2M65LZLKSK3DJN4TAMLSDRZ3SG7OFDIPQXIYEC66WLII2IBNAC
PRGPM7QVW24DZAAZMGG7UEKE53VU5QOVMUEQZQ4TTGQMADCUU7WAC
PP2IIHL6EK4HBFFSYAQNV35BKIK6D4EL2JQOY7NZVJX2DXCLSMGAC
XX7G2FFJ4QCGQGD4REAW5QFHVYAKCFUPGZCK7L6DFGS5ISVBYBQQC
R5QXEHUIZLELJGGCZAE7ATNS3CLRJ7JFRENMGH4XXH24C5WABZDQC
S5ADH7USXGZCRISF5TQOAST7RQQ2EUX5QVLFMGVTWTS65KFOO7MAC
W5UPTBTO4FUGEZ63ZCJ4JCBO2SMZCN5YXKGFIC2WH5YJYY5OBYSAC
Data = {
Ind={Ind='X', Pak=2, Aus=2},
NZ={NZ='X', Eng=2},
SA={SA='X', Aus=2, SL=2},
Pak={Pak='X', Ind=0, SL=2},
Aus={Aus='X', Ind=0, SA=0, SL=2},
SL={SL='X', SA=0, Pak=0, Aus=0},
Eng={Eng='X', NZ=0}
}
on.mouse_press = function(x,y, mouse_button)
if mouse_press_consumed_by_any_button_handler(Global_state, x,y, mouse_button) then
return
end
end
Global_state = {} -- just anything we need across functions
if t[t1][t2] then
local px = (cx[x] - l - App.width(t[t1][t2])) / 2
love.graphics.print(t[t1][t2], l+px, top+y*c+py)
end
button(Global_state, t1..t2, {
x=l, y=top+y*c,
w=cx[x] - l,
h=c,
color = {1,1,1, 0},
icon = function(params)
if t[t1][t2] then
local px = (params.w - App.width(t[t1][t2])) / 2
App.color{r=0, g=0, b=0}
love.graphics.print(t[t1][t2], params.x+px, params.y+py)
end
end,
onpress1 = function()
local v = t[t1][t2]
if v == 'X' then return
elseif v == nil then
t[t1][t2] = 0 t[t2][t1] = 2
elseif v == 0 then
t[t1][t2] = 2 t[t2][t1] = 0
elseif v == 2 then
t[t1][t2] = nil t[t2][t1] = nil
else
error('invalid value')
end
end,
})
draw_table({
Ind={Ind='X', Pak=2, Aus=2},
NZ={NZ='X', Eng=2},
SA={SA='X', Aus=2, SL=2},
Pak={Pak='X', Ind=0, SL=2},
Aus={Aus='X', Ind=0, SA=0, SL=2},
SL={SL='X', SA=0, Pak=0, Aus=0},
Eng={Eng='X', NZ=0}
})
Global_state.button_handlers = {}
draw_table(Data)