I have a simple VBS function below that I want to move completely into LUA. Can someone help with the equivalent? (The select statement is straight forward, it's the COM object stuff that has me stuck). Thanks,

Function X10Group(XN,XS,XP)
  Dim HCA 'As Object
  Set HCA = GetObject(, "HCA.Object")

  Dim value

  Select Case XS
  	Case "ON"
      value = HCA.Group.On(XN)
  	Case "OFF"
      value = HCA.Group.On(XN)
    Case Else
      MsgBox ("X10command: Invalid GROUP state (Parameter 3 must be ON | OFF)")
  End Select
  Set HCA = Nothing
End Function