This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

lua table range of dates
#2
You need to use modulo (%) operator for this:
Code:
data = {}

today = os.date('%w')
for i = 1, 14 do
  data[ i ] = (today - i) % 7
end

log(data)
Reply


Messages In This Thread
lua table range of dates - by benanderson_475 - 20.08.2020, 05:17
RE: lua table range of dates - by admin - 20.08.2020, 06:46
RE: lua table range of dates - by Dré - 20.06.2021, 11:48
RE: lua table range of dates - by admin - 20.06.2021, 12:25

Forum Jump: