So I'm dabbling with some Lua programming in Visionaire. This function (which I put in the "definition script" area) checks if all six bricks are aligned in a simple brick puzzle.
The function is called everytime the user rotates one of the bricks. But either the function itself or the way I call it has one or several errors in it, because it wont work.
function bricksAligned()
    bricks = {Objects["BrickA1"], Objects["BrickA2"], Objects["BrickB1"], Objects["BrickB2"],                         Objects["BrickC1"], Objects["BrickC2"]}
     for i, brick in bricks
     do
        if (brick.Rotation ~= 0) then
           return false 
        end
      end
   return true
end
The calling of the above function takes place in this code:
rotateBrick(Objects["BrickA1"])
if (bricksAligned() == true) then
  [the user solved the puzzle; do stuff]
end
Please someone help out!