lights FAQ Forum github.com/luapower/dlist
dlist

Unsupported
syscall
bnet
lfs
lanes
mmap WIP
stdio WIP
vararg
nanojpeg
openvg WIP
hpdf
svg_parser WIP
ffi_reflect
struct
pmurhash
murmurhash3
md4
crc32
ringbuffer
dlist
obj_parser
glut
fbclient WIP
portaudio
libssh2 WIP
minizip
terra
llvm
utf8 WIP
ucdn
chipmunk
libvlc WIP
libvorbis WIP

dlist

doubly linked lists


local dlist = require'dlist'

Doubly linked lists in Lua. Doubly linked lists make insert, remove and move operations fast, and access by index slow. In this particular implementation items must be Lua tables for which fields _prev and _next must be reserved for linking.

dlist() -> list
dlist:new() -> list
create a new list
list:clear() clear the list
list:push(t) add an item at end of the list
list:unshift(t) add an item at the beginning of the list
list:insert(t[, after_t]) add an item after another item (or at the end)
list:pop() -> t remove and return the last item, if any
list:shift() -> t remove and return the first item, if any
list:remove(t) -> t remove and return a specific item
list:next([current]) -> t next item after some item (or first item)
list:prev([current]) -> t previous item after some item (or last item)
list:items() -> iterator<item> iterate items
list:reverse_items() -> iterator<item> iterate items in reverse
list:copy() -> new_list copy the list

Last updated: 2 years ago | Edit on GitHub

Pkg type:Lua
Version: r1-9-g09349b9
Last commit:
License: PD
Requires: none
Required by: none

Top