Issue with Lua Script in TouchOSC MK2 to parse /eos/out/cmd

Message:
"Hi everyone,
I am trying to create a custom 'Dimmer Check' display in TouchOSC MK2 to use with ETC EOS Nomad.
My goal is to display only the Address number on a Label by parsing the feedback from /eos/out/cmd. For example, if the command line shows LIVE: Cue 4 : Address 7 #, I want my Label to only display 7.
The connection is working fine: when I use a simple Label (no script) with the address /eos/out/cmd, I receive the full text string correctly.
However, as soon as I use a Lua script to filter the string, the Label stops updating (it remains empty or shows the default value). I have tried several syntax variations for MK2 (using msg[1].value, msg[2][1].value, etc.) but nothing seems to trigger.
Here is the script I am currently using in the Label's script editor:
lua
function onReceiveOSC(message, connections)
  local path = message[1]
  local args = message[2]

  if path == "/eos/out/cmd" then
    if args[1] ~= nil then
      local textReceived = args[1].value
      -- Regex to find the number after the word 'Address'
      local dimmerNum = string.match(textReceived, "Address%s+(%d+)")
      
      if dimmerNum then
        self.values.text = dimmerNum
      else
        self.values.text = "---"
      end
    end
  end
end
Is there a specific way TouchOSC MK2 handles OSC arguments from EOS that I am missing? Should I be looking at a different output path or a different Lua syntax to access the string value?
Thanks for your help!"
Pace

Related