Jump to content

$array [100] [20] [3]


Recommended Posts

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

Link to comment
Share on other sites

as far as i know autoit doesnt support 3D Arrays

Link to comment
Share on other sites

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

Link to comment
Share on other sites

#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]

Link to comment
Share on other sites

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

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]

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...