lights FAQ Forum github.com/luapower/vararg
vararg

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

vararg

vararg manipulation


local vararg = require'vararg'

Lua library for manipulating variable arguements (vararg) of functions. These functions allow you to do things with varargs that cannot be efficiently done in pure Lua but can be easily done through the C API.

NOTE: This library is not that useful with LuaJIT because these functions cannot be inlined.

p = vararg.pack(...)
  p()              --> ...
  p("#")           --> select("#", ...)
  p(i)             --> (select(i, ...))
  p(i, j)          --> unpack({...}, i, j)
  for i,v in p do  --> for i,v in apairs(...) do

API

vararg.range(i, j, ...) unpack({...}, i, j)
vararg.remove(i, ...) t={...} table.remove(t,i) return unpack(t,1,select("#",...)-1)
vararg.insert(v, i, ...) t={...} table.insert(t,i,v) return unpack(t,1,select("#",...)+1)
vararg.replace(v, i, ...) t={...} t[i]=v return unpack(t,1,select("#",...))
vararg.append(v, ...) c=select("#",...)+1 return unpack({[c]=val,...},1,c)
vararg.map(f, ...) t={} n=select("#",...) for i=1,n do t[i]=f((select(i,...))) end return unpack(t,1,n)
vararg.concat(f1,f2,...) return all the values returned by functions 'f1,f2,...'

Last updated: 2 months ago | Edit on GitHub

Pkg type:Lua/C
Version: r3-28-gfc0903b
Last commit:
License: MIT
Import ver: 1.0.1
Requires: +luajit 
Required by: none

Top