19.03.2018, 07:08
Code:
latitude = 11.11
longitude = 22.22
sunrise, sunset = rscalc(latitude, longitude)
date = os.date('*t')
now = date.hour * 60 + date.min
-- from 0:00 to sunrise
if now < sunrise then
alert('before sunrise')
-- from sunset to 23:59
elseif now > sunset then
alert('after sunset')
else
alert('day')
end