setInstructionLimit()

When I run this, the program stops when z reaches 16. If I comment out the first z=0 and uncomment the second one, it stops when z reaches 33 and it flashes something in the watch area when z is around 16. It looks like “error: error: Lua program has exceeded instruction limit”. Why does the placement of z=0 have an effect on the instruction limit.


function setup()
    watch("z")
    z=0    -- this stops at z=16
    setInstructionLimit(100)
    --z=0    -- this stops at z=33 with a flash of something around z=16
end

function draw()
    z=z+1
end