Syncing from a set - is it valid?

I’ve only just worked out you can do this - which is super useful. Right back at the start I was stuggling with farming out control values to loops, basic concurrency stuff. This pattern solves that at a stroke and means less code.

Question is, I can’t find it in the help - is it a feature that I can rely on @samaaron ?

live_loop :a do
  set :foo, tick
  sleep 1
end

live_loop :b do
  n=sync :foo
  puts n
end

Yep, this is definitely supported behaviour. set and cue are actually variants of the same concept since v3 :slight_smile:

1 Like

Yeh! And particularly that you can get the value via n=sync, excellent. Thanks Sam

in others words :

live_loop :a do
  cue :foo,  tick
  sleep 1
end

live_loop :b do
  n = sync :foo
  puts n
end

and a melodic example :slight_smile:

live_loop :a do
  cue :foo, (scale :c, :aeolian).tick
  sleep 1
end

live_loop :b do
  n = sync :foo
  play  n
end
1 Like

Thanks, yes that’s good. How are set and cue different then?

Well Sam told us they are the same no ?

Variants of the same concept, he said