Jump to content
Sign in to follow this  
dazza

$array [100] [20] [3]

Recommended Posts

dazza

This code returns an error:

Dim $array[100][20][30]
$array[1][1][1] = "cake"

==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:

Can I not use 3d arrays? :P

Share this post


Link to post
Share on other sites
cageman

that code doesn't give any error. you can use up 64 dimensions ( got that directly from the helpfile )

i tested the code myself and works fine for me.

Share this post


Link to post
Share on other sites
CodyBarrett

as far as i know autoit doesnt support 3D Arrays

Share this post


Link to post
Share on other sites
BlackPhoenix

This code returns an error:

Dim $array[100][20][30]
$array[1][1][1] = "cake"

==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:

Can I not use 3d arrays? :P

#include <Array.au3>

Dim $array[100][20][30]
$array[1][1][1] = "cake"
Msgbox(0,'Arraytest','Array contains:'&$array[1][1][1])

It works, try that code

Share this post


Link to post
Share on other sites
SpookMeister

#include <Array.au3>

Dim $array[100][20][30]
$array[1][1][1] = "cake"
Msgbox(0,'Arraytest','Array contains:'&$array[1][1][1])

It works, try that code

You do not need to include array.au3 for that example, only needed if you want to use special array functions like _ArraySort or _ArrayDisplay etc.

[edit] typo

Edited by SpookMeister

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Share this post


Link to post
Share on other sites
weaponx

You don't need array.au3, especially since it has no functions for arrays over 2 dimensions.

Share this post


Link to post
Share on other sites
BlackPhoenix

You do not need to include array.au3 for that example, only needed if you want to use special array functions like _ArraySort or _ArrayDisplay etc.

[edit] typo

Yeah you're right. ^^

Share this post


Link to post
Share on other sites
dazza

Aha!

You cannot use the upper limit.

So $array[100][1][1] returns an error whilst $array[99][1][1] doesn't

So I have to dim the array as:

Dim $array[101][21]31]

Thanks for the feedback guys

Edited by dazza

Share this post


Link to post
Share on other sites
SpookMeister

For Example:

Dim $array[3]

creates these three array elements:

$array[0]
$array[1]
$array[2]

Trying to access $array[3] will give you an error because it does not exist


[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Share this post


Link to post
Share on other sites
dazza

Sorted!

Many thanks.

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  

×