These forums are CLOSED. Please visit the new forums HERE
Changing values in a list |
|
|
BrunoOlsen Oh
Registered User
Join date: 30 Mar 2007
Posts: 38
|
04-30-2007 05:22
I want to change a value in a list at a spicific index chosen by different circumstances. The index is in a var, and that is not the problem, the problem is how to change the value. How do I do that?
|
|
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
|
04-30-2007 05:49
|
|
BrunoOlsen Oh
Registered User
Join date: 30 Mar 2007
Posts: 38
|
04-30-2007 07:37
is that the only way?
|
|
Kenn Nilsson
AeonVox
Join date: 24 May 2005
Posts: 897
|
04-30-2007 09:36
It's by far the best way.
_____________________
--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. |
|
BrunoOlsen Oh
Registered User
Join date: 30 Mar 2007
Posts: 38
|
04-30-2007 10:19
hmm, I risk truncating...
|
|
Destiny Niles
Registered User
Join date: 23 Aug 2006
Posts: 949
|
04-30-2007 10:37
To replace one value you would use a list with just one entry.
ie. CODE
|
|
BrunoOlsen Oh
Registered User
Join date: 30 Mar 2007
Posts: 38
|
04-30-2007 13:23
To replace one value you would use a list with just one entry. ie. CODE
So, if I'm updating a value I should do something like (say, I'm changing Charles): CODE
|
|
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
|
04-30-2007 14:18
So, if I'm updating a value I should do something like (say, I'm changing Charles):
|
|
BrunoOlsen Oh
Registered User
Join date: 30 Mar 2007
Posts: 38
|
05-02-2007 10:00
aha. Ok, thanks
Dealing with lists is a bit different than dealing with arrays, that's why this whole "replace-thing" threw me off ![]() |
|
AnnMarie Otoole
Addicted scripter
Join date: 6 Jan 2007
Posts: 162
|
05-02-2007 20:14
The problem with the llListModifyList is you have to modify it with another list, even if only a single element list and the list name cannot be a variable.
I wrote a custom function I've been using for some time that replaces an entry in a list with a new variable of any type. CODE
|
|
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
|
05-02-2007 20:30
I'm not sure I see the advantage in using your function over llListReplaceList.
It doesn't use less memory (more, actually), and it definitely won't run nearly as fast as the built-in function. |
|
Yumi Murakami
DoIt!AttachTheEarOfACat!
Join date: 27 Sep 2005
Posts: 6,860
|
05-02-2007 21:16
The problem with the llListModifyList is you have to modify it with another list, even if only a single element list and the list name cannot be a variable. It's perfectly legal to specify [x] as the src parameter of llListModifyList if you want to replace a single item in the list with the contents of variable x. The real problem with llListModifyList is that it makes a copy of the list during the modification process, thus requiring twice as much memory as it otherwise would ![]() |