Files
lua-matrix/matrix
Adrian Perez de Castro b0cbf93b7e Use a callback in client:sync() to determine when to stop the loop
Instead of adding more and more possible conditions on which the while-loop
inside client:sync() could stop, support passing a callback function which is
used to determine when to stop the loop.

The old "so N iterations behaviour" can be achieved with something like:

  function iterate_n_times(n)
    return function ()
      n = n - 1
      return n == 0
    end
  end
  client:sync(iterate_n_times(10))

If no function is passed, the client:sync() function loops forever.
2016-07-05 01:09:51 +03:00
..