Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

We Need Arrays!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Chance Small
Linden PITA
Join date: 30 Jul 2003
Posts: 170
09-28-2004 11:35
Sure, lists are EXCELLENT, but we... need... ARRAYS!

Those of you that don't know what an array is...

You have a variable, which is an item that means another items... For example...


string myvar = "value";
llSay(0, "I set 'variable' to '"+myvar+"');
// Which would say: "I set 'variable' to 'value'"

Now, what's an array? An array is a variable that acts like a list in a way, for example...

array myarray;
myarray[0] = 3;
myarray[1] = 6;
llSay(0, (string)myarray[0]+" plus "+(string)myarray[1]+" equals "+(string)((integer)myarray[0] + (integer)myarray[1]));
// Which would say: "3 plus 6 equals 9"



Now, you can practically do this with lists, however it requires more management to use lists.

An example of how arrays are easier to manage than lists:
You have a game with 8 seats (players). 2 OR more players can play.

With a list, you keey track of each players keys, and keep track of which seat they are in... Minimal amount of lists needed is 2, not to mention keeping track of which seats are actually being used, and which player is in those seats... Or you can use up your LIMITED script memory and have a variable for each seat holding the key. (Keep in mind you'd have to do the same for player bank rolls, player bets, and if it's a card game, player cards, player hand ranks, etc.)


NOW, with a heavenly array, very simple... Player sits in seat 2...

player[2] = playerkey;


Lists are great, but I see it as a limited, resource optimizing limit, that arrays would clear up, and ease the scripting process.

Any other oppinions?

P.S.
I'm pretty sure this has been requested before, but maybe we can add some pressure.
Tiger Crossing
The Prim Maker
Join date: 18 Aug 2003
Posts: 1,560
09-28-2004 14:36
If we had more list manipulation commands, I'd be happy...

llReplaceInList( list, item, position )

llListReplaceInList( list, sublist, start_position )

Adding array notation runs afoul of type casting. the llList2String, llList2Integer, etc functions typecast as they extract. Array notation leaves no room. You could only do this if the list/array itself was of a single type.

list_integer myList = [ 1, 2, 3 ];
list_string myStrs = [ "A", "B", "C" ];

myStrs[1] = (string)myList[1];

// myStrs now is [ "A", "2", "C" ];

But the two functions mentioned above would give lists the one remaining accessor missing from LSL's list implementation.
_____________________
~ Tiger Crossing
~ (Nonsanity)
Hank Ramos
Lifetime Scripter
Join date: 15 Nov 2003
Posts: 2,328
09-28-2004 16:58
We need a lot more than arrays.
Hiro Pendragon
bye bye f0rums!
Join date: 22 Jan 2004
Posts: 5,905
09-28-2004 18:32
*broken record*

Pointers discussion, yadda yadda.

What we really need is a list managed by Linden Lab of the features that are planned, being considered, and rejected, so that we can stop repeating the same discussions about features over and over.
_____________________
Hiro Pendragon
------------------
http://www.involve3d.com - Involve - Metaverse / Emerging Media Studio

Visit my SL blog: http://secondtense.blogspot.com
Morgaine Dinova
Active Carbon Unit
Join date: 25 Aug 2004
Posts: 968
09-28-2004 18:55
From: someone
Originally posted by Hiro Pendragon
*broken record*

Pointers discussion, yadda yadda.

Indeed it's a broken record Hiro, because you're learning nothing from previous attempts to explain array technology to you. See last item.
_____________________
-- General Mousebutton API, proposal for interactive gaming
-- Mouselook camera continuity, basic UI camera improvements
Huns Valen
Don't PM me here.
Join date: 3 May 2003
Posts: 2,749
09-28-2004 19:30
screw arrays, give us HASHTABLES
Oz Spade
ReadsNoPostLongerThanHand
Join date: 23 Sep 2003
Posts: 2,708
09-28-2004 20:45
I wouldn't mind having arrays or better list controls, or both, or everything. :)
_____________________
"Don't anticipate outcome," the man said. "Await the unfolding of events. Remain in the moment." - Konrad
Dougal Jacobs
Registered User
Join date: 16 Jun 2004
Posts: 21
09-28-2004 22:28
Well im glad to see im not the only one who thinks this might just be the greatest improvement in LSL since its release if it ever gets implemented... Lindens... Are you listening? Please? Ill give you a cookie!!!
Hiro Pendragon
bye bye f0rums!
Join date: 22 Jan 2004
Posts: 5,905
09-28-2004 22:28
From: someone
Originally posted by Morgaine Dinova
Indeed it's a broken record Hiro, because you're learning nothing from previous attempts to explain array technology to you. See last item.


Ouch, dude. A little personal on this one?
_____________________
Hiro Pendragon
------------------
http://www.involve3d.com - Involve - Metaverse / Emerging Media Studio

Visit my SL blog: http://secondtense.blogspot.com
Andreyl Satyr
Registered User
Join date: 7 Mar 2004
Posts: 10
09-28-2004 23:43
Arrays would be very very nice to have in LSL, while the ease of definition is one advantage my real problem with lists are

whatever[1] = 5;

is 100X easier than


whatever = llDeleteSubList(whatever,1,1);
whatever = llListInsertList(whatever,[5],1);

I hate doing that, it is so inconvenient and inefficient.
Eggy Lippmann
Wiktator
Join date: 1 May 2003
Posts: 7,939
09-29-2004 01:02
From: someone
Originally posted by Huns Valen
screw arrays, give us HASHTABLES

Is hash all you ever think about? If you want hash, you should talk to Darko, not post in the feature suggestions forum.
Morgaine Dinova
Active Carbon Unit
Join date: 25 Aug 2004
Posts: 968
09-29-2004 06:43
From: someone
Originally posted by Hiro Pendragon
Ouch, dude. A little personal on this one?

Sorry, Hiro, you're right. I didn't need to be harsh to make my point.

While it's no excuse, I used to be a lecturer in computing so I don't like it when I see misinformation being spread about how a feature works, especially if done repeatedly since it then starts to look like malice. All it takes is one small seed and it can bloom into a whole pile of new programmers getting a false impression, since many readers will have no prior knowledge in the subject. But I didn't need to be personal. Just another pointer to the explanation would have been enough.

I apologize. :-) Keep up the good work.
_____________________
-- General Mousebutton API, proposal for interactive gaming
-- Mouselook camera continuity, basic UI camera improvements
Morgaine Dinova
Active Carbon Unit
Join date: 25 Aug 2004
Posts: 968
10-01-2004 16:40
Does anyone here have a link to the Linden post that said that arrays were being worked on already? I used to have it, but it's gone now.

I made the mistake of thinking that all forum posts were available indefinitely in the user's postings list, lol, and now there's a bunch of stuff I can no longer browse.
_____________________
-- General Mousebutton API, proposal for interactive gaming
-- Mouselook camera continuity, basic UI camera improvements
Catherine Omega
Geometry Ninja
Join date: 10 Jan 2003
Posts: 2,053
10-03-2004 02:54
It was Don Linden who mentioned it here.
_____________________
Need scripting help? Visit the LSL Wiki!
Omega Point - Catherine Omega's Blog
Morgaine Dinova
Active Carbon Unit
Join date: 25 Aug 2004
Posts: 968
10-03-2004 03:00
Thanks Cath. Firmly in bookmarks now. :-)
_____________________
-- General Mousebutton API, proposal for interactive gaming
-- Mouselook camera continuity, basic UI camera improvements