lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Wesley Smith wrote:
what is a good solution for this function:

function nextData()
    currentData = (currentData+1) % (#data)   --gives [0, #data-1]
    return data[currentData]
end

function nextData()
  currentData = currentData % #data + 1
  return data[currentData]
ebd

-- (start currentData at either 0 or #data)