I had some fun playing around with this.
Here some hints for improvement:
Did you know you could rewrite the following line
{["state"]=3, ["posX"]=2, ["posY"]=2, ["pitch"]=25},
to
{state=3, posX=2, posY=2, pitch=25},
?
It does exactly the same and isn't cluttered with brackets and quotes.
And you should definitely try two for loops to create your buttons:
--iterate through posY = 2,3,4 ... 16
for posY = 2,16 do
local row = {}
--add table row to the list buttons
table.insert(buttons, row)
--iterate through posX = 2,5,8 ... 44 (notice how the third parameter = 3 defines