I want to use a function which expects three arguments
GL.Scale(2.0, 0.4, 1.0);
I assumed I could put the parameters in an array
scale=[2.0, 0.4, 1.0]
pass it to an object
def initialize(scale) @scale = scale
end
and have a method call the function
GL.Scale(@scale);
but GL.Scale expects 3 arguments, and @scale counts as one.
What is the way to pass a group of argument? It would be uggly code
to write something like
GL.Scale(@scale[0],@scale[1],@scale[2])
but GL.Scale expects 3 arguments, and @scale counts as one.
What is the way to pass a group of argument? It would be uggly code
to write something like
GL.Scale(@scale[0],@scale[1],@scale[2])
Thank you for your responses.
I had found the use of * to define a method, so the method will accept
variable number of arguments.
But I think that is different from the usage Gregory B. and Daniel
Harple suggested. There the * is used in front of an array passed on to
a function already defined.
Thank you for your responses.
I had found the use of * to define a method, so the method will accept
variable number of arguments.
But I think that is different from the usage Gregory B. and Daniel
Harple suggested. There the * is used in front of an array passed on to
a function already defined.