Difference between revisions of "Linklist"
From OpenEUO
(Created page with "== Calling Pattern == Call local k = sl.linklist() Results k is a linklist closure == Closure Methods == * linklist.getposition * linklist.head * [[linklist.insertaf...") |
m (→Description) |
||
Line 36: | Line 36: | ||
== Description == | == Description == | ||
− | Calling linklist returns a closure to a doubly linked list. Most operations on the linked list | + | Calling linklist returns a closure to a doubly linked list. Linklist takes the object abstraction down the the list level only-- individual links are opaque and have no methods. Most operations on the linked list make use of or return pseudo-indices, which are actually indices into the underlying storage table. Like all simplelib interfaces beginning with version 0.06, method names may be partially specified. See the closure method pages for details. |
== See Also == | == See Also == |
Latest revision as of 14:39, 18 December 2010
Calling Pattern
Call
local k = sl.linklist()
Results
k is a linklist closure
Closure Methods
- linklist.getposition
- linklist.head
- linklist.insertafter
- linklist.insertbefore
- linklist.length
- linklist.nextlink
- linklist.prevlink
- linklist.removelink
- linklist.returntable
- linklist.setvalue
- linklist.swap
- linklist.tail
- linklist.value
Example Usage
local k = sl.linklist() local j = k.insertb(0,'one') j = k.insertb(j,'two') j = k.insertb(j,'three') print(k.value(k.next(j))) print(k.value(k.head()))
--> two three
Description
Calling linklist returns a closure to a doubly linked list. Linklist takes the object abstraction down the the list level only-- individual links are opaque and have no methods. Most operations on the linked list make use of or return pseudo-indices, which are actually indices into the underlying storage table. Like all simplelib interfaces beginning with version 0.06, method names may be partially specified. See the closure method pages for details.