This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

attempt to compare number with nil
#1
Keep getting this error and I'm not sure how to get rid of it.

3/0/41 is DPT1
3/0/21 is a percentage value. I have tried using DPT9 and now using DPT5

3/0/21 is mostly at 0%, I've tried to manually set the GA to 0 to be sure it's not nil.

Code:
Resident script:9: attempt to compare number with nil
stack traceback:


Code:
local auxswitch = grp.getvalue('3/0/41')
local auxstatus = grp.getvalue('3/0/21')


if auxswitch == true then
  grp.write('3/0/57', 0)
elseif (auxswitch == false and auxstatus == 0) then
  grp.write('3/0/57', 1)
elseif (auxswitch == false and auxstatus >= 1 and auxstatus <= 33) then
  grp.write('3/0/57', 2)
elseif (auxswitch == false and auxstatus >= 34 and auxstatus <= 66) then
  grp.write('3/0/57', 3)
elseif (auxswitch == false and auxstatus >= 67 and auxstatus <= 100) then
  grp.write('3/0/57', 4)
end
Reply


Messages In This Thread
attempt to compare number with nil - by sx3 - 28.11.2022, 08:32

Forum Jump: