Jump to content

reading data from array


 Share

Recommended Posts

so i have this weird error , im pretty sure it used to work before

lets say i got an array $array[10][10]

i have every array define $array[1][0] = "blabla"

now the issue is this ; when i just use msgbox(0,"",$array[1][0]) its fine it returns the array

but when i use it in function 

func blabla()

      msgbox(0,"",$array[1][0]) - i get blank message

endfunc

Can anyone help me please?

      

 

Link to comment
Share on other sites

I suspect it has to do with the scope in which the array is/was defined.  Where in the script are you creating the array, because in your simple example above it is not defined which means it would have to be scoped globally for the function to know about it.

Can you post more code?

Link to comment
Share on other sites

32 minutes ago, dadabre3232 said:

array is defined as global before using , maybe thats the issue ?

nope.  You need to make the array available/accessible within the function somehow, either by declaring it in the global scope or sending it to the function as a parameter.

 

14 minutes ago, dadabre3232 said:

pasted into brand new autoit file ... works

hmm, odd.

Link to comment
Share on other sites

it works in some funcs in some it doesnt weird , i have a function that compares inputs with the predefined ini file, works outside func, inside doesnt 

global $list[5][3]

$list[1][1] = iniread...

msgbox(0,"",$list[1][1]) - works here

$list[1][2]=guiread....

func compare($i)

     msgbox(0,"",$list[1][1]) - empty here
     if $list[$i][1] = ""  or  $list[$i][2] = "" then Return
     if $list[$i][1] <> $list[$i][2] Then
          msgbox(0,"","different")
      EndIf
EndFunc

for $i = 1 to 5

     compare($i)

next

scripts returns everytime cause somehow list is empty inside the func and fine outside...

 

Link to comment
Share on other sites

Do you get access error?

The problem with pseudo code is that no-one can test it.

If you were to try to create a real script that people could test, I guarantee you will realize you error along the way.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

I understand what your thing is, but I can say with almost 100% certainty that you script is much more complicated with more stuff going on.

Create a simple minimal script which reproduces your issue, along with a temp ini file.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

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