Difference between revisions of "Linklist.removelink"

From OpenEUO
Jump to: navigation, search
(Created page with "== Calling Pattern == Call local k = sl.linklist() -- later local r = k.removelink(a) Arguments a is a number Results r is a number == Example Usage == local k = sl.lin...")
 
m (Description)
 
Line 24: Line 24:
 
== Description ==
 
== Description ==
  
Calling removelink detaches and recycles a valid link with pseudo-index a. If successful, a is echoed in the return value.  If the list is empty, if a is the tail of the list, or if a is otherwise an invalid pseudo-index, removelink returns 0.
+
Calling removelink detaches and recycles a valid link with pseudo-index a. The value associated with the link is lost.  If successful, a is echoed in the return value.  If the list is empty, or if a is otherwise an invalid pseudo-index, removelink returns 0.
  
 
== See Also ==
 
== See Also ==

Latest revision as of 18:27, 18 December 2010

Calling Pattern

Call

local k = sl.linklist()
-- later
local r = k.removelink(a)

Arguments

a is a number

Results

r is a number

Example Usage

local k = sl.linklist()
local j = k.inserta(0,'one')
j = k.inserta(j,'two')
j = k.inserta(j,'three')
k.remove(j)
print(k.value(k.tail()))
--> two

Description

Calling removelink detaches and recycles a valid link with pseudo-index a. The value associated with the link is lost. If successful, a is echoed in the return value. If the list is empty, or if a is otherwise an invalid pseudo-index, removelink returns 0.

See Also