Re: array index and modulo
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: array index and modulo
- From: Rici Lake <lua@...>
- Date: 2007年3月29日 02:46:19 -0500
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)