![Wink ;)](./images/smilies/icon_wink.gif)
![Wink ;)](./images/smilies/icon_wink.gif)
Maybe I've read it wrong, I believe Tom's first attempt doesn't rely on LUA, which might make it more "understandable" to me than yours. I plan to dive into LUA too, though I have no clue when I'll be able to.
I meant that both elements are dropped from their respective arrays and only one instance is passed to the new sorted array- so yeah, the second one is what already happens in the patch i posted. The only problem is that you need to trigger it as many times as the new(sorted) array has members.cturner wrote: ↑Fri Nov 12, 2021 12:22 pm
This sounds like you're talking procedurally, not in terms of what you want as a result of your algorithm. You're not suggesting that
[0, 1, 4, 5, 7, 13, 15, 16, 19, 22, 25, 28]
should be the output, are you?
I'd think that
[0, 1, 4, 5, 7, 10, 13, 15, 16, 19, 22, 25, 28]
is what you'd want, correct?
It sounds like you need to put more effort into understanding what an array is. You're ignoring the "information value" of the index.
Maybe something like this?
Code: Select all
function arc.module.receive(inlet, object)
-- build a table sequence length 8 of random true and falses
t = {}
for i = 1, 8 do
t[#t + 1] = math.random(2) == 1
end
-- convert the sequence to an arc array, and output it
arc.module.outlets[1]:send(arc.array.new(table.unpack(t)))
end
© KVR Audio, Inc. 2000-2024
Submit: News, Plugins, Hosts & Apps | Advertise @ KVR | Developer Account | About KVR / Contact Us | Privacy Statement