Page 1 of 1 1
Topic Options
#24954 - 2002-07-12 03:51 AM Rename Array
t_pickering Offline
Fresh Scripter

Registered: 2001-11-23
Posts: 26
Hi,

Is it possible to rename an array with the value of a variable?

For example:-

code:
  

GLOBAL $array[0]
$array_name = "MY_FIRST_ARRAY"
$array = $array_name

Or

code:
$array = "MY_FIRST_ARRAY"
GLOBAL $array[0]

Neither work.

I asked the same question 9 months ago, unfortunately I forgot how to do it [Mad] and the posts are no longer on the message board.

Thanks,

Tim.

[Wink]

Top
#24955 - 2002-07-12 03:58 AM Re: Rename Array
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Here's one way:
code:
GLOBAL $array[1]
$array[0] = "Element 1"
$array[1] = "Element 2"
$array_name = "MY_FIRST_ARRAY"
$rc=execute("$$$array_name=$array")

for each $item in $MY_FIRST_ARRAY
? $item
next



[ 12 July 2002, 04:03: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#24956 - 2002-07-12 04:01 AM Re: Rename Array
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Or:
code:
$array = "MY_FIRST_ARRAY"
$rc=execute("GLOBAL $$$array[1]")
$MY_FIRST_ARRAY[0]="A"
$MY_FIRST_ARRAY[1]="B"

for each $item in $MY_FIRST_ARRAY
? $item
next



[ 12 July 2002, 04:01: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#24957 - 2002-07-12 05:40 AM Re: Rename Array
t_pickering Offline
Fresh Scripter

Registered: 2001-11-23
Posts: 26
Thanks,

Tim.

Top
#24958 - 2002-07-12 03:54 PM Re: Rename Array
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
t_pickering:
Posts on this message board do not disappear unles the moderator deletes them. So, I guess, the posts are still here but you are unable to find them. Have you tried using the BBS search function?
_________________________
There are two types of vessels, submarines and targets.

Top
#24959 - 2002-07-12 07:16 PM Re: Rename Array
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
I suspect it's the search by member thingy...

It kinda broke with the last UBB upgrade. One can only get hits on posts "after" the upgrade when "Search By Registered Member Number" is used.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

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 847 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.053 seconds in which 0.024 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