Draycos Goldaryn
Member
Greetings,
I'm back and am working on a few projects. One of which will utilize multiple resolutions. I had a script I wrote before that allowed a basic fade to/from black for the resolution, and now I am in the process of modifying it to also allow other transitions. My issue right now is this: I'm trying to define a method where any and all variables are optional. For example:
How would I make it so that:
Any help would be appreciated. Note, I know how to make it run the transitions themselves, I just want to know how to make the declared variables optional as i have demonstrated.
Thank you,
Draycos Goldaryn
I'm back and am working on a few projects. One of which will utilize multiple resolutions. I had a script I wrote before that allowed a basic fade to/from black for the resolution, and now I am in the process of modifying it to also allow other transitions. My issue right now is this: I'm trying to define a method where any and all variables are optional. For example:
Code:
module foo
def bar(duration=16, file='', invert=false)
#some code
end
end
How would I make it so that:
- If I were to call
Code:
foo.bar
- If I were to call
Code:
foo.bar(20)
- If I were to call
Code:
foo.bar('trans1')
- If I were to call
Code:
foo.bar(20, 'trans1')
- If I were to call
Code:
foo.bar('trans1', true)
- and if I were to call
Code:
foo.bar(20, 'trans1', true)
Any help would be appreciated. Note, I know how to make it run the transitions themselves, I just want to know how to make the declared variables optional as i have demonstrated.
Thank you,
Draycos Goldaryn