Created
April 26, 2015 21:11
-
-
Save nefftd/2d230a8b0e0b4fdb81a9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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