I have some code I found on the internet a few years ago (thanks to whoever wrote it). I now want to modify it slightly but, not being a programmer by trade, I find I do not understand the last two “return” statements. My understanding is that between 10:00 and 14:00 it should return TRUE (and run the scene) and outside that time frame it should return FALSE. Can anyone help me here?
local pStart = "10:00" -- Start of time period local pEnd = "14:00" -- End of time period local allow = true -- true runs scene during period, false blocks it local hS, mS = string.match(pStart,"(%d+)%:(%d+)") local mStart = (hS * 60) + mS local hE, mE = string.match(pEnd,"(%d+)%:(%d+)") local mEnd = (hE * 60) + mE local tNow = os.date("*t") local mNow = (tNow.hour * 60) + tNow.min if mEnd >= mStart then return (((mNow >= mStart) and (mNow <= mEnd)) == allow) else return (((mNow >= mStart) or (mNow <= mEnd)) == allow) end