Jump to content
Sign in to follow this  
Slythfox

Arrays

Recommended Posts

Slythfox

EDIT: I fixed it. Apparently you have to declare the max size of the array (ex: Dim $Data[3]).

I have something like this:

#include <array.au3>
Dim $Data

$Data[1] = "foo"
$Data[2] = "bar"
Msg(0, $Data[1], $Data[2])

I get this "Badly formated variable or macro" error.

What am I doing wrong?

Edited by Slythfox

Share this post


Link to post
Share on other sites
Jos

EDIT: I fixed it. Apparently you have to declare the max size of the array (ex: Dim $Data[3]).

I have something like this:

#include <array.au3>
Dim $Data

$Data[1] = "foo"
$Data[2] = "bar"
Msg(0, $Data[1], $Data[2])

I get this "Badly formated variable or macro" error.

What am I doing wrong?

I get a totally different error:

C:\Development\winutil\AutoIt3\programs\test\test.Au3(6,26) : ERROR: Msg(): undefined function.
Msg(0, $Data[1], $Data[2])
~~~~~~~~~~~~~~~~~~~~~~~~~^

But you need to DIm your Array like this; Dim $data[3]

:)


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Slythfox

;could do this

Dim $Data[3]

$Data[0] = 2

$Data[1] = 'foo'

$Data[2] = 'bar'

MsgBox(0, $Data[1], $Data[2])

;or this

Dim $Data[3] = [2, 'foo', 'bar']

MsgBox(0, $Data[1], $Data[2])

Yeah. I got it fixed. 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  

×

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.