[ TIP ] randomly return -1 or +1

This may seem obvious to some but hopefully will be helpful to others… so I thought that I would post. I use this all of the time. If you are building something in Corona and want to randomly generate only a positive 1 or negative 1 value (i.e. no zero) this is helpful and compact.

local direction    = (math.random(1,2)*2)-3

it replaces data structures like “if then”

Nice!

Nice!