BruceCopperField Posted February 10, 2008 Share Posted February 10, 2008 I need to pass a lot of parameters to a function. They are part of a larger logical record. In C/C++, I can use struct type and just pass a single pointer to the struct. Is there any similar facility in AutoIt? I don't want to put a long list of parameters into the function definition. Is there anyway to shorten the list of parameters? Link to comment Share on other sites More sharing options...
Developers Jos Posted February 10, 2008 Developers Share Posted February 10, 2008 I need to pass a lot of parameters to a function. They are part of a larger logical record. In C/C++, I can use struct type and just pass a single pointer to the struct. Is there any similar facility in AutoIt? I don't want to put a long list of parameters into the function definition. Is there anyway to shorten the list of parameters?You could put them all in an Array and pass the Array as ByRef. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
BruceCopperField Posted February 10, 2008 Author Share Posted February 10, 2008 You could put them all in an Array and pass the Array as ByRef. But my parameters are of different types. I know I can put different types in Array, but is it a good design to do so? Link to comment Share on other sites More sharing options...
Developers Jos Posted February 10, 2008 Developers Share Posted February 10, 2008 Don't see an issue with that really. Anything specific you think could be an issue ? Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
BruceCopperField Posted February 11, 2008 Author Share Posted February 11, 2008 Don't see an issue with that really. Anything specific you think could be an issue ?JosIt works. ..but it is definitely not a good programming style. Just like we don't have to declare the variables but problems are going to appear if our script is getting very large and complex. There is why record/struct datatypes are created in addition to Array in other programming languages. Link to comment Share on other sites More sharing options...
MHz Posted February 11, 2008 Share Posted February 11, 2008 (edited) It works. ..but it is definitely not a good programming style. Just like we don't have to declare the variables but problems are going to appear if our script is getting very large and complex. There is why record/struct datatypes are created in addition to Array in other programming languages.Welcome to a typeless (variant) language and how it is up to you to check the type of variable used. The functions are there to check variable types so no reason why you cannot succeed. Good luck. Edited February 11, 2008 by MHz 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