Linklist.returntable

From OpenEUO
Revision as of 15:12, 18 December 2010 by Ximan (Talk | contribs) (Description)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Calling Pattern

Call

local k = sl.linklist()
-- later
local r = k.returntable([b])

Arguments

b optional is a boolean

Results

r is a table

Example Usage

local k = sl.linklist()
local j = k.inserta(0,'one')
j = k.inserta(j,'two')
j = k.inserta(j,'three')
print(sl.keyvalstr(k.returntable()))
--> table keys:values = {
    1:one,
    2:two,
    3:three,
    }

Description

Calling returntable creates a table with values stored in the linked list . If successful, r is a table with head value as element 1, and tail value as element n, where n is the length of the linked list. If the optional boolean argument is specified as false, the order of the returned table will be reversed. If unsuccessful, returntable returns an empty list, {}. **In version 0.06, this method is named gettable. Fixed in upcoming versions.**

See Also