Jump to content
Sign in to follow this  
Burgaud

Array into an Array

Recommended Posts

Burgaud

I have a function that returns 4 data as an array like:
 

func CreateToolTip()
    local $handle[4]
    $handle[0] = ...
    $handle[1] = ...
    $handle[2] = ...
    $handle[3] = ...
    return($handle)
endfunc

And use it without problem:

GLOBAL $MainToolTip = CreateToolTip (....)

.
.
.
PrintToolTip($MainToolTip......)

 

Now I have an Array

GLOBAL $Hidden[3]

My purpose of this Hidden[3] array is to contain  three(3) sets of data returned by CreateToolTops, ie:

for $i = 1 to 3
    $Hidden[$i] = CreateToolTip(...)
next

However, I am getting:

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

What to do?

define $Hidden as GLOBAL $Hidden[3][4]?

Then Hidden[$i] = CreateToolTip?

 

Edited by Burgaud

Share this post


Link to post
Share on other sites
iamtheky

Arrays are 0 based, count 0 to 2 instead of 1 to 3.


,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites
Burgaud
16 minutes ago, iamtheky said:

Arrays are 0 based, count 0 to 2 instead of 1 to 3.

facepalm

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  

×