View Single Post
Old 20th June 2008, 16:29   #12  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,431
Quote:
Originally Posted by IanB View Post
Why do you think you want "current_frame" as a global var. It is only supposed to have scope in the code and routines subordinate to a conditional invocation.
The short answer is, to allow run-time functions to be used inside user functions called from a run-time script (see here).

Currently, this doesn't work - I don't know whether this was an intentional restriction, or something accepted as an unfortunate side-effect of the implementation, or simply an oversight.

While useful in its own right (eg you could write a function to compute a weighted second order luma interpolation value), the ability to call run-time functions in a user function gives you more than just that. For the first time, it would allow the entire run-time script to be put inside a function body, eg called as ScriptClip("f()"). The script's statements would then be evaluated in a separate scope, eliminating the problems that can arise from unintended sharing of variable names in different run-time scripts.

Making current_frame global makes all this possible. And since it would not be defined until the first run-time script is evaluated, it would still be available only inside run-time scripts.
Gavino is offline   Reply With Quote