This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
jag's profile picture

Unpack() Alternitive

Started by jag, 26 July 2013 - 02:54 PM
jag #1
Posted 26 July 2013 - 04:54 PM
So I was messing around in Touch Lua (iOS app) and noticed how the unpack() finction seems to not exist (See picture).

I can't really come in contact with the app developers, so is there a possible way to make a new similar unpack function that does basically the same thing.
LBPHacker #2
Posted 26 July 2013 - 05:10 PM
http://www.lua.org/pil/5.1.html
function unpack (t, i)
  i = i or 1
  if t[i] ~= nil then
    return t[i], unpack(t, i + 1)
  end
end
jag #3
Posted 26 July 2013 - 05:11 PM
Awesome!
Thank you very much!!