基本的に、データをプルする必要があるデバイスがいくつかあります。温度測定値が設定された制限を下回ったり上回ったりすると、複数の電子メールが届きます。for
制限内または制限を超えている現在のすべてのデバイスの状態を 1 つのメールに含めるループが必要です。
body = for device_name, 1 do
device_name++ -- I get error here because unexpected symbol near 'for'
"Device Name: " ..device_name.. "\nDevice Location: " ..device_location..
"\n--------------------------------------------------------------" ..
"\nCurrent Temperature: " ..temperature.." F".. "\nTemperature Limit: ("..
t_under_limit.. "-" ..t_over_limit.. " F)" .."\n\nCurrent Humidity Level: " ..
humidity .. "%".. "\nHumidity Limit: (" .. h_under_limit.. "-" ..h_over_limit.. "%)"
.. "\n\n-------Time Recorded at: " ..os.date().. "-------"})
end, -- end for