Multiple output streams in a for loop

Moderator: admin

Multiple output streams in a for loop

Postby Cactus » Sat Jul 08, 2017 10:23 am

I have a for loop
It creates a output stream based on each value

I want it to be able to create individual separate output streams for each value
Currently as it iterates over the values in the for loop, it only leaves the most recent one with 1 output stream. Anything before that is not remembered

For example:
Code: Select all
For x in y do:
o = output_stream(x)

When I have 100 of x in y table, I am obviously left with only one o, where I wanted 100 o's (o1,o2,o3,etc.)

Can somebody show example lua code on how to accomplish this
Sorry if this is silly
Never chase the money, let the money come to me
User avatar
Cactus
FXCodeBase: Graduate
 
Posts: 242
Joined: Fri Feb 19, 2016 11:46 am
Location: Errywhere

Re: Multiple output streams in a for loop

Postby Cactus » Mon Jul 10, 2017 8:22 am

Ok I have now managed to solve this using global table like so

Code: Select all
for i = 1,tonumber(linecount) do   
    _G['outs'..i] = instance:addStream(tostring(i), core.Line, name, (tostring(i).."_e"), --color_extended, first)
end

for i = 1,counter do   
    r = _G['outs'..i]
end


then I use "r" in a loop, so everytime it is outs1, outs2, outs3 and so on
Never chase the money, let the money come to me
User avatar
Cactus
FXCodeBase: Graduate
 
Posts: 242
Joined: Fri Feb 19, 2016 11:46 am
Location: Errywhere


Return to Indicator Development

Who is online

Users browsing this forum: No registered users and 7 guests