EasyManua.ls Logo

ControlByWeb X-600M - Page 130

ControlByWeb X-600M
158 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Appendix G: Lua Scripts X-600M Users Manual
Month 1-12
Day 1-31
Year 1900 – 3000
Hour 0-23
Minute 0-59
Second 0-59
time.copy(timeTable)
This function will return a copy of the time table passed to it.
time.getComponents(timeTable)
This function will return a table with the time in component form. The table has the following fields:
month 1-12
mday 1-31 (Day of month)
year year
hour 0-23
min 0-59
sec 0-59
wday 1-7 (Day of week. Sunday – Saturday)
yday 1-365 (Day of year)
isdst 0-1 (1 = Daylight Savings in Effect, 0 = Daylight Savings not in Effect)
The following example will print the current date and time to the debug console once a second.
Notice that this example has comments. Comments begin with two dashes “--” :
enableDebug()
while true do
sleep(1000)
--Get current time
currentTime = time.now()
--Get the component time
compTime = time.getComponents(currentTime)
print("compTime ")
print(" " .. compTime.month .. "/" .. compTime.mday .. "/" .. compTime.year)
print(" " .. compTime.hour .. ":" .. compTime.min .. ":" .. compTime.sec)
end
Note: Times created using time.now, time.seconds, and time.make, can be compared to each other,
added/subtracted from each other, multiplied/divided by each other, and can be converted to a
human readable date and time using the tostring function.
logToFile(logFileNumber)
This function will cause a logging event to occur on the log file specified by it's log file number 1- 5.
For example:
logToFile(1)
email(emailDef)
This function will cause an email message to be sent using the information found in the emailDef
table. For example:
emailDef = {
rcpt = "grp.admin",
subj = [[This is a test email.]],
body = [[The internal temp sensor reads]] .. io.owSensor1
Page 128 Xytronix Research & Design, Inc.

Table of Contents