View Single Post
  #10  
Old 02-06-2009, 05:36 PM
Loriel Loriel is offline
Somewhat rusty
Loriel's Avatar
Join Date: Mar 2001
Posts: 5,059
Loriel is a name known to allLoriel is a name known to allLoriel is a name known to allLoriel is a name known to all
Quote:
Originally Posted by Stefan View Post
The params[] array is only created when the script is called (doesn't even need to be a function, GS1 style). That is either on an event, or when you call a function of another object. To get a variable number of parameters either use func(arg1, arg2, arg3, arg4 etc) and ignore the arguments that you don't want, or pass the parameters as array.
Thanks, that clears it up. Some experimentation suggested the FAQ thread was inaccurate about this and some dude on IRC said it only worked for triggers, so that makes sense.

Quote:
Currently accessing the parameters for each function as array is not possible because it would mean a big speed slowdown, although if it's really important to have it then we could add something like temp.functionparams[] which dynamically converts the function parameters to variables.
Not important, I really just wanted to build an error reporting function that would forward all its arguments to format() and print the resulting string with more error stuff, instead of having the user call format, and consequently got confused about how variadic functions even work.
Reply With Quote