Hi.
I think there may be an error in bricks.bricktype_to_quad function, in chapter 2, item 5.
The function signature is: function bricks.bricktype_to_quad( bricktype )
However, bricktype is never used. Instead of it, id is used where bricktype should be.
Therefore, the function signature should be function bricks.bricktype_to_quad( id ).
I hope I have helped.
By the way, great job with this tutorial! Congrats! I am learning a lot with it.