@samme I think that would work yes, I found a messy workaround for my specific situation which let me use my already existing arrays.
For left and right checking I held 2 bools ( left and right ) in a forloop when checking the tiles, when both were true at the end of the forloop the tile would be locked, but only if they were on the same level:
if(buttons[i].position.x <= buttons[card.index].position.x + tileWidth + offset && buttons[i].position.x >= buttons[card.index].position.x + tileWidth - offset)
countRight = true;
It's messy because I'm not working with columns due to tile being able to get placed on halfway spots as well. This works though for the left and right checking but is not ideal. the reason I'm using an offset range is because my positions are not always that precise for some reason, don't know why.