X-600M Users Manual
Appendix G: Lua Scripts
}
email(emailDef)
end
The email definition table has the following fields:
rcpt
– the user (usr.username) or group (grp.groupname) that will receive the email. (grp.all will
send an email to all users.)
subj
– the subject line of the email (must be a string)
body
– the body of the email (must be a string)
pulse(io, pulseTimeSeconds)
This function will cause the specified relay or register to pulse for
pulseTimeSeconds
seconds. The
relay parameter is the name of a relay and the
pulseTimeSeconds
is a number.
pulse(“io.relay1”, 1.5)
sleep(milliSeconds)
This function will cause the Lua script to stop executing for the specified number of milliseconds.
This function can only be called from the 5 Lua Scripts, not Lua expressions
. If called from
Lua expressions, it will just return. This function is useful when a script needs to wait some time
before checking the result of a previous operation.
enableDebug()
io.relay1 = 1
sleep(10000)
if io.relay1 == 1 then
print("Relay 1 is now on")
else
print("Relay 1 is still off. We should have waited longer to check.")
end
ping(address, timeoutSeconds)
This function can be used to ping another Ethernet-enabled device and check for a response. It will
ping the address or host name specified, and will attempt to ping the remote device for a timeout
(seconds) before giving up. The return value of this function indicates the results.
This function can
only be called from the 5 Lua Scripts, not Lua expressions
.
1 = Host responded
0 = Host did not respond
-1 = Can't run from Lua Expressions
-2 = Host unknown
-3 = Internal Error
-4 = Timeout
-5 = Bad host name length
enableDebug()
result = ping("192.168.1.15", 5)
if result == 1 then
print("Found device at 192.168.1.15")
elseif result == 0 then
Xytronix Research & Design, Inc.
Page 129
Содержание X-600M
Страница 1: ...X 600MTitle Page Goes Here...
Страница 6: ...X 600M Users Manual Page 4 Xytronix Research Design Inc...
Страница 99: ...X 600M Users Manual Setup Pages Xytronix Research Design Inc Page 97...
Страница 116: ...Appendix B Installing New Firmware X 600M Users Manual Page 114 Xytronix Research Design Inc...