Jump to content

Passing A Lot of Parameters to A Function


Recommended Posts

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

  • Developers

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

  • Developers

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

Don't see an issue with that really. Anything specific you think could be an issue ?

Jos

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.
Link to comment
Share on other sites

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 by MHz
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...