Skip to content

Instantly share code, notes, and snippets.

@nefftd
Created April 26, 2015 21:11
Show Gist options
  • Save nefftd/2d230a8b0e0b4fdb81a9 to your computer and use it in GitHub Desktop.
Save nefftd/2d230a8b0e0b4fdb81a9 to your computer and use it in GitHub Desktop.
do
local function _lua_unpack(t, i, j)
if i <= j then
return t[i], _lua_unpack(t, i + 1, j)
end
end
function lua_unpack(t, i, j)
assert(type(t) == 'table','bad argument #1')
assert(j == nil or type(j) == 'number','bad argument #3')
if not i then i = 1 end
if not j then j = #t end
if j < i then return end
return _lua_unpack(t, i, j)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment