Linklist.prevlink

From OpenEUO
Jump to: navigation, search

Calling Pattern

Call

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

Arguments

a is a number

Results

r is a number

Example Usage

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

Description

Calling prevlink returns the pseudo-index of the link preceding the valid link with pseudo-index a. If the list is empty, if a is the head of the list, or if a is otherwise an invalid pseudo-index, prevlink returns 0.

See Also