| View previous topic :: View next topic |
| Author |
Message |
taizong
Joined: 19 Mar 2011 Posts: 15
|
Posted: Sat Jun 30, 2012 8:46 pm Post subject: Is there a "stack" or simple way to make one? |
|
|
I'm wondering if there is a "stack" datatype available in tintin++? There is this functionality I believe in zmud.
http://en.wikipedia.org/wiki/Stack_%28abstract_data_type%29
Or would it be relatively easy to script something like this?
Some example uses of a stack:
1. For example you could "push" a bunch of targets to a stack, and then after killing each target "pop" it and then move on to the next one.
2. Or let's say you are in a fight, and a spell wears off which can't be cast in battle. Each spell that wears off could be pushed to the stack, and after the fight you cast them and pop them off the stack.
3. Or if you are a healer each round you can push X healing spells to the stack, and then prioritize by casting from the top of the stack.
Or is this not useful, and I should just accomplish the same using else-if ladders and/or variable arrays? |
|
| Back to top |
|
 |
Scandum Site Admin
Joined: 03 Dec 2004 Posts: 3274
|
Posted: Sat Jun 30, 2012 9:25 pm Post subject: |
|
|
To push you can use:
#list bla insert -1 {whatever}
And to pop:
#list bla delete -1
To see the size use:
&bla[] |
|
| Back to top |
|
 |
taizong
Joined: 19 Mar 2011 Posts: 15
|
Posted: Sat Jun 30, 2012 9:37 pm Post subject: |
|
|
| Thanks Scandum! That's perfect, I didn't realize that lists could be used in this way. |
|
| Back to top |
|
 |
|