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.

Receive UDP string
#5
@AlexLV, see this example, it will accept "on", "off" and any numeric value:
Code:
data = server:receive()
if data then
  chunks = data:split(' ')
  
  if #chunks == 3 and chunks[ 1 ] == 'group' then
    addr = chunks[ 2 ]
    value = chunks[ 3 ]

    if value == 'on' then
      value = true
    elseif value == 'off' then
      value = false
    else
      value = tonumber(value)
    end

    if value ~= nil then
      grp.write(addr, value)
    end
  end
end
Reply


Messages In This Thread
Receive UDP string - by leonidas - 24.08.2017, 13:16
RE: Receive UDP string - by admin - 24.08.2017, 17:51
RE: Receive UDP string - by AlexLV - 24.08.2017, 22:47
RE: Receive UDP string - by leonidas - 28.08.2017, 05:25
RE: Receive UDP string - by admin - 28.08.2017, 08:54
RE: Receive UDP string - by AlexLV - 04.09.2017, 08:41
RE: Receive UDP string - by Diggerz - 15.02.2021, 01:38
RE: Receive UDP string - by admin - 15.02.2021, 07:46
RE: Receive UDP string - by Diggerz - 18.02.2021, 08:56
RE: Receive UDP string - by admin - 18.02.2021, 08:58

Forum Jump: