Deque
From OpenEUO
Revision as of 16:09, 18 December 2010 by Ximan (Talk | contribs) (Created page with "== Calling Pattern == Call local d = sl.deque() Results d is a deque closure == Closure Methods == * deque.back * deque.capacity * deque.clone * [[deque.front...")
Calling Pattern
Call
local d = sl.deque()
Results
d is a deque closure
Closure Methods
- deque.back
- deque.capacity
- deque.clone
- deque.front
- deque.peek
- deque.peekat
- deque.peekback
- deque.peekfront
- deque.pop
- deque.popback
- deque.popfront
- deque.push
- deque.pushback
- deque.pushfront
- deque.size
Example Usage
local a00 = sl.deque() for a01 = 1,10 do a00.pushback(a01,a01) end local a03 = a00.clone() for a02 = 1,20 do print(tostring(a02)..' '..tostring(a00.size())..' '..tostring(a00.pop())) end
--> 1 20 1 2 19 1 3 18 2 4 17 2 5 16 3 6 15 3 7 14 4 8 13 4 9 12 5 10 11 5 11 10 6 12 9 6 13 8 7 14 7 7 15 6 8 16 5 8 17 4 9 18 3 9 19 2 10 20 1 10
Description
Calling deque returns a closure to a ended queue. See the closure methods for more information.