for i = 0, 999 do io.write(string.format("%03d\n", i)) a = nil while(a ~= "locked" and a ~= "unlocked") do a = io.read() end if(a == "unlocked") then break end end