Nezoic Posted August 4, 2013 Share Posted August 4, 2013 I couldn't find any information on overloading function with different parameter signatures so I figured I would ask if it was possible. For example Func AddStuff($a) ;overloads AddStuff($a, $b, $c) Same function name but different param signature overloads Return MyFunc($a, 0, 0) End Func Func AddStuff($a, $b) ;overloads AddStuff($a, $b, $c) Same function name but different param signature overloads Return MyFunc($a, $b, 0) End Func Func AddStuff($a, $b, $c) ;Work is done in primary function Return $d = $a + $b + $c End Func Link to comment Share on other sites More sharing options...
trancexx Posted August 4, 2013 Share Posted August 4, 2013 In AutoIt you make use of default parameters: Func AddStuff($a, $b = 0, $c = 0) Return $a + $b + $c EndFunc That function can take one, two or three arguments now. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
JohnOne Posted August 5, 2013 Share Posted August 5, 2013 You can also use @NumParams macro with such functions, which will indicate how many arguments were actually passed. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now