[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [sc-users] preProcessor woes
Is this false func thing about return context maybe? Returning outside of the do loop like this actually seems to work:
(
thisProcess.interpreter.preProcessor = {|codeBlock|
var o, b = codeBlock.split($\n);
b.do{|code|
c = code.split($ );
if(code.beginsWith("w"
), {
c.scramble.postln;
}, {
o = code.replace("(").replace(")");
});
};
o;
};
)
> 23 dec. 2018 kl. 21:00 skrev emp@xxxxxxxxxxxxxx:
>
> Hi,
>
> I posted this question on the forum as well, but realize that maybe not that many use preProcessor on a daily basis, and not all of you are there so I’ll try here too. Sorry for the cross-posting.
>
> Trying to get my head tuned to the inner workings of Interpreter’s preProcessor. Maybe someone can explain why it always posts a nil in both the true func and the false func below? The true func works besides the ugliness of the nil post. The false func should just send the code to the regular interpreter, treating it as a normal sc line. It doesn’t.
>
> Thanks!
> Mattias
>
> (
> thisProcess.interpreter.preProcessor = {|codeBlock|
> var b = codeBlock.split($\n);
> b.do{|code|
> c = code.split($ );
> if(code.beginsWith("w"
> ), {
> c.scramble.postln;
> }, {
> code;
> });
> };
> };
> )
>
> (
> why does the preProcessor return nil when executing this block? the scramble function obviously works.
> why oh why? it looks bad in my post window.
> )
>
> "and why does this line return nil and not just this string?”
>
>
> _______________________________________________
> sc-users mailing list
>
> info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
> archive: https://listarc.bham.ac.uk/marchives/sc-users/
> search: https://listarc.bham.ac.uk/lists/sc-users/search/
_______________________________________________
sc-users mailing list
info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: https://listarc.bham.ac.uk/marchives/sc-users/
search: https://listarc.bham.ac.uk/lists/sc-users/search/