Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
31st December 2011, 04:07 | #1 | Link |
Registered User
Join Date: Aug 2008
Posts: 233
|
Referenced variables in AviSynth?
Many other scripting languages allow referenced variables; so that a function can modify an existing variable – or a large variable can be passed without needing to duplicate it in memory. For example:
For a case where I'd like to modify the value of "foo", it would be convenient to be able to write [something like]: Code:
FunctionName(\foo) Code:
foo = FunctionName(foo) |
31st December 2011, 20:31 | #2 | Link |
Registered User
Join Date: Sep 2011
Posts: 86
|
http://avisynth.org/mediawiki/Grammar
Functions always produce a new value and never modify an existing one. What that means is that all arguments to a function are passed "by value" and not "by reference"; in order to alter a variable's value in AviSynth script language you must assign to it a new value. If you can give an example of what you are trying to do, someone can probably come up with an equivalent solution. |
1st January 2012, 20:42 | #4 | Link |
Registered User
Join Date: Jan 2005
Location: Praha (not that one in Texas)
Posts: 863
|
I promised you workaround...
You might find inspiration here which is what I recently used: Code:
global crlf=" "+Chr(10)+ Chr(13) function SelectMultiple(string c, int n, int i){ str0=c+"_"+string(n)+"_"+string(i)+"="+c+".SelectEvery("+string(n)+","+string(i)+")"+".Subtitle(string("+string(i)+"))"+crlf str= (i==0) ? str0 : SelectMultiple(c, n, i-1)+str0 return str } d1=FFVideoSource(srcfile1, pp="hb/vb:10:60", threads=1) Eval(SelectMultiple("d1", 5, 4)) Interleave(d1_5_0,d1_5_1,d1_5_2,d1_5_3,d1_5_4) |
Tags |
reference, variable |
Thread Tools | Search this Thread |
Display Modes | |
|
|