Page 1 of 1 1
Topic Options
#522 - 1999-09-28 12:50 AM Using arrays in script
Anonymous
Unregistered


Hello,

Has anyone tried using arrays yet? I can't get them to work with a global statement.

code:
Global $sserver[3]

It does work with a Dim statement, but I have to make sure to Dim the array at my outermost context if I want to use the array globally.

Another problem I have noticed in the declarations is: The manual states:

code:
Dim $Counters[14]
Dim $Sums[20]

"The first declaration creates an array with 15 elements, with index numbers running from 0 to 14. The second creates an array with 21 elements, with index numbers running from 0 to 20."

When I try the following code:

code:
Dim $Counters[14]
$index=0
while $index<15
$Counters[$index]=$index
? "Counters[$index]="+$Counters[$index]
$index=$index+1
loop

I receive an array reference out of bounds error message when the value of index goes to 14 and the script tries to execute the assignment statement. It seems to me that the code:

code:
Dim $Counters[14]

is really creating a 14 element array with index numbers running from 0 to 13. Has anyone else experienced this or have any other input?

Finally on arrays, is there a function to return the maximum index of an array?

Regards,

Brad

Top
#523 - 1999-09-27 01:16 PM Re: Using arrays in script
Anonymous
Unregistered


Hello all,

Another thing I wanted to pass on about arrays is there functioning in single step mode. That is, they function OK in the script, but you cannot query the value while in single step mode. I always get <unknown> as the value. Anyone else run into this?

Regards,

Brad

Top
#524 - 2001-05-15 05:51 PM Re: Using arrays in script
Anonymous
Unregistered


I am experiencing similar problems with arrays. Was there ever a response to Brad's questions?
Top
#525 - 2001-05-15 06:19 PM Re: Using arrays in script
cj Offline
MM club member
*****

Registered: 2000-04-06
Posts: 1102
Loc: Brisbane, Australia
What version of KiX are you using?

Maximum entry: KiX 2001 Beta has a function called UBOUND that returns the Upper BOUNDry of the array:

ie if your array is:

$array[0]=345
$array[1]=765
$array[2]=234
$array[3]=123
$array[4]=778

then

UBOUND($array)

will return 4. There are 5 entries, but number 4 is the top one. All arrays start at 0

Because they all start at Zero, DIMensioning an array with 10 elements will give you $array[0] to $array[9]. There is a misprint in the User Manual.

Global problems? Can you please post the line of code before and after this command. I have been using GLOBAL $array[10] a lot and it has always worked...

in fact, if you DIM $array[10] then try to access $array inside a UDF (User Defined Function, KiX2001 new feature) it will not work. If you GLOBAL it instead, it will.


Sometimes the error is not the line that is displayed, but the one before it. IDK why and I haven't tested this enough to properly demonstrate it (I will later though).

Hope that helped, I haven't used the DEBUG feature enough to know what it does with arrays. TBH I have never used the debug feature, sorry.

cj

------------------
cj's scripts page
cj's User Guide - 14 May 2001

chrismat@ozemail.com.au

Top
#526 - 2001-05-15 09:38 PM Re: Using arrays in script
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
yes please, what version of kix are you using!

learn from my pain... http://kixtart.org/board/Forum2/HTML/001292.html

Bryce

------------------
kix.isorg.net

Top
#527 - 2001-05-16 01:58 PM Re: Using arrays in script
Anonymous
Unregistered


Hello All,

I was using the latest version that was available in Aug 99. I don't remember what that was. For some reason, I never got notification that anyone responded to my post until today (15 May 2001))! What gives? Am I in a time warp?

------------------
Regards,

Brad
Consultant
Navius Technologies, LLC

Top
#528 - 2001-05-16 05:17 PM Re: Using arrays in script
cj Offline
MM club member
*****

Registered: 2000-04-06
Posts: 1102
Loc: Brisbane, Australia
No-one posted a reply to this message until now. I saw aaron_myers's post and chimed in.

cj

Top
#529 - 2001-05-16 06:07 PM Re: Using arrays in script
bleonard Offline
Seasoned Scripter
*****

Registered: 2001-01-19
Posts: 581
Loc: Chicago, IL
bvvanor - try checking the Kix32.exe for the version you are running.
Top
#530 - 2001-05-19 05:03 AM Re: Using arrays in script
MCA Offline
KiX Supporter
*****

Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
Dear,

A way of checking your kixtart version can be done by kix32 /?.
For a complete check of kixtart files (kix32.exe, kx16.dll, kx32.dll, kx95.dll + kxrpc.dll) you
can use our script version.kix, which is available on our site.

http://home.wanadoo.nl/scripting

Greetings.

------------------
Site map:

_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1821 anonymous users online.
Newest Members
ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder, M_Moore
17887 Registered Users

Generated in 0.074 seconds in which 0.038 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org