Jump to content
Sign in to follow this  
dramaking

Array of Struct?

Recommended Posts

dramaking

Is it possible to create an array of struct?

Share this post


Link to post
Share on other sites
Yashied
dramaking

Could you please show an example? Thanks in advance.

Share this post


Link to post
Share on other sites
MvGulik

You might like to be more clear about the problem your having.

To me It looks like you forgot to read the AutoIt Help file, Section "Array's" at the "Language Reference - Variables" page.

( ... or => http://www.autoitscript.com/autoit3/docs/intro/lang_variables.htm )


"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Share this post


Link to post
Share on other sites
dramaking

I was trying to create an array of struct in a single statement this whole time and it gave me an error message. Fortunately, I came up with a solution:

$a[2]
For $k = 0 to 1
   $[k] = DllStructCreate("int a; int b")
Next

Share this post


Link to post
Share on other sites
MvGulik

Yep the "how to" create and fill a array with data in one command is missing from the that page. (hidden in Dim/Global/... page.)

Dim $Array1[12]

$Array1[0] = 3

$Array1[1] = 7.5

... etc.

Or, all in one:

Dim $Array1[12]=[3, 7.5, "string"], $array[5] = [8, 4, 5, 9, 1]

Or in your case.

dim $a[2]=[DllStructCreate("int a; int b"), DllStructCreate("int a; int b")]

Edited by MvGulik

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.