Doc Nerd
Registered User
Join date: 7 Oct 2005
Posts: 20
|
12-18-2005 23:36
While I still find myself pulling my hair out, and swearing like a New York cabbie over the LSL's lack of arrays, I have been finding fairly good work arounds. Like I've mentioned in some of my previous posts, I'm one for hacking out *FUNCTIONAL* stuff, as well as cool/fun stuff. Like today in my 5 hour hack session creating a working email terminal (might have the script on the Library forum soon) I had to delete an item from a list. Once again, thinking that the LSL used arrays, I tried the following: listName -= ["removedItem"]
Yeah...no fun. After then trying to set up a metric shit-ton of conditional statements - which I later found didn't work correctly, completely forgetting about the annoyance on the first page >.< - an idea! i = llListFindList(listName, ["removedItem"]); listName = llDeleteSubList(listName, i, i);
Sure, it's assuming that the list has no repeating values, but I don't like my lists to have repeating values. So for all intents and purposes, this is as close to a -= operator I can pull off. Okay, not to make this a show off thread, I want to hear some other nice workarounds everyone's come up with concerning lists.
|
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
|
12-19-2005 01:14
I try not to use lists, they have alot of overhead when using strings. I've writen a good bunch of functions for working with strings, and i've got a few more bouncing around my head. It really depends on what needs to be stored. Lists are like brain damage, you learn to work around and with them.
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river. - Cyril Connolly
Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence. - James Nachtwey
|
Kenn Nilsson
AeonVox
Join date: 24 May 2005
Posts: 897
|
12-19-2005 08:16
Doc...I use your same function really...and yes, I also kick things over the lack of arrays.
_____________________
--AeonVox--Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms chasing ghosts, eating magic pills, and listening to repetitive, addictive, electronic music.
|
Marcus Moreau
frand
Join date: 25 Dec 2004
Posts: 602
|
12-19-2005 08:20
You could probably do your own for loop to walk through the list and delete any matching entries. This would probably work better for a list where there might be duplicates. But I am assuming it would take the same amount of computational time, since the ListFindList probably does for loop iteration anyways.
Just a thought.
MM
|
Ghordon Farina
Script Poet
Join date: 1 Nov 2005
Posts: 126
|
12-19-2005 08:23
You kick things... I kick people. (In SL.)
Ghordon Farina: WHYYY!!??? Where are the ARRAYS??? Winter Hatfield: There are none. This isn't C. (Sadly) Ghordon Farina starts flailing wildly about the room, attacking everything in sight. Winter Hatfield gets out of the way. Ghordon Farina: Sorry... got you right in the face didn't I? Winter Hatfield clutches her nose and replies "Yes... bastard." Ghordon Farina looks concerned. Winter Hatfield pulls out her ShieldBreaker, aiming it squarely between Ghordon's eyes... Ghordon Farina: NOOOO!!! Winter Hatfield: bang. Second Life: Ghordon Farina is offline.
...
|
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
|
12-19-2005 10:51
Until we get Mono, any user function to mimic an LSL function will be slower.
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river. - Cyril Connolly
Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence. - James Nachtwey
|