$eval: Difference between revisions

From Scriptwiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 5: Line 5:
Example:
Example:
   [[var]] %var = m00
   [[var]] %var = m00
   var %string = % [[$]]+ var
   var %string = % [[$|$+]] var
Now echoing %var would echo "m00" and echoing %string would echo "%var"
Now echoing %var would echo "m00" and echoing %string would echo "%var"
   [[echo]] -a $eval(%string,0)
   [[echo]] -a $eval(%string,0)
Line 14: Line 14:
   echo -a $eval(%string,2)
   echo -a $eval(%string,2)
This would echo "m00" since the string is first evaluated to %var and %var is then evaluated to m00
This would echo "m00" since the string is first evaluated to %var and %var is then evaluated to m00
[[Category:Other Identifiers]]

Revision as of 21:35, 5 July 2006

Returns the string N times evaluated.

 $eval(string,N)

If N isn't specified, N is set to 1.

Example:

 var %var = m00
 var %string = % $+ var

Now echoing %var would echo "m00" and echoing %string would echo "%var"

 echo -a $eval(%string,0)

This would echo "%string" since %string is not evaluated.

 echo -a $eval(%string,1)

This would echo "%var" since %string is evaluated once. Notice that this is the same as echoing %string

 echo -a $eval(%string,2)

This would echo "m00" since the string is first evaluated to %var and %var is then evaluated to m00