View Single Post
Old 3rd June 2008, 22:22   #1  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,431
Problems using AverageLuma etc in user-defined function

Why can't I use a run-time function (like AverageLuma) inside my own function, as long as my function is only called inside a run-time script (eg via ScriptClip)? Why doesn't this work:
Code:
function AL(clip c) {
  Subtitle(c, string(AverageLuma(c)))
}
...
ScriptClip("AL()")
when it's effectively equivalent to this:
Code:
ScriptClip("Subtitle(string(AverageLuma()))")
which does?

It's clear that run-time functions can only be used inside a run-time script. But here the call to function AL is inside the run-time script. I also understand the distinction between parse-time and run-time, which is usually at the root of problems with ScriptClip and friends. But here both the failing script ("AL()") and the working one ("Subtitle(...)") are at the same level.

Is it a bug, or a feature, or is my code wrong?
Gavino is offline   Reply With Quote