Jump to content
Sign in to follow this  

Peculiar "Subscript used without an array variable" error on a 1x3 array

Recommended Posts

;Copy the [n][3] ObjectTable from the class properties
    local $aObjectTable = $oSelf.ObjectTable

    ;Determine [n]
    local $iElements = UBound($aObjectTable,1)

    ;Debug script - Output says 1 row, 3 columns (which is correct, in this instance)
    If IsArray($aObjectTable) Then MsgBox(0, "AnnihilateElements", "Still an array" & @CRLF & "Rows: " & $iElements & @CRLF & "Columns :" & UBound($aObjectTable, 2))

    ;Store object from first column of table (These next three lines cause the error)
    local $oObject = $aObjectTable[0][0]
    local $sGUID = $aObjectTable[0][1]
    local $hObj = $aObjectTable[0][2]

According to the called MsgBox, the array is one row and three columns in size (as expected). According to UBound($aObjectTable, 0), it is only one dimensional. If I address $aObjectTable as a one dimensional array, it throws an out-of-bounds array index error. Any suggestions?

Edited by Flaky

Share this post

Link to post
Share on other sites


1 - "Subscript used without an array variable" and "out-of-bounds array index error" are two different problems. Which is it?

2 - What is $oSelf.ObjectTable? If it is an object then $aObjectTable becomes an object and amy need to be iterated differently (for... in...next...)

3 - Without runnable code it is difficult to provide any specific help.


edit: syntax

Edited by kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...