Has anyone implemented a simple set of scripts to push items (integers, floats, strings, keys) onto a stack or heap and then get them back out again?
If not I will have to write my own, just didnt want to re-invent the wheel.
These forums are CLOSED. Please visit the new forums HERE
push/pull or push/pop |
|
|
Gregory McLeod
Registered User
Join date: 21 Oct 2006
Posts: 278
|
04-02-2007 06:25
Has anyone implemented a simple set of scripts to push items (integers, floats, strings, keys) onto a stack or heap and then get them back out again?
If not I will have to write my own, just didnt want to re-invent the wheel. |
|
Destiny Niles
Registered User
Join date: 23 Aug 2006
Posts: 949
|
04-02-2007 08:41
LSL really don't have that type of function that I am aware of. However a list should be able to serve your purpose.
http://www.lslwiki.net/lslwiki/wakka.php?wakka=list |
|
Gregory McLeod
Registered User
Join date: 21 Oct 2006
Posts: 278
|
04-02-2007 10:05
Thanks, I had wanted to avoid using lists if at all possible because of the poor performance they have.
|
|
bucky Barkley
Registered User
Join date: 15 May 2006
Posts: 200
|
04-02-2007 11:09
You didn't say if you were going to mix types of items pushed within a given stack.
You could use a list, and maintain a separate integer that points to the top of the stack. That will get you out of having to use llGetListLength. You could cast items to a string, concatenate to a stack string, and then have an integer that gives the offset to the last item. You'll have to keep playing with the string (chopping)... .. or have a list of integers that coded with two items: offset and length. Would be interesting to hear which approach is faster... playing with strings, or using a list with an integer pointer to the top item. _____________________
Bucky Barkley -- Mammal, Scripter, Builder, Lover
|