Home AMX User Forum NetLinx Studio
Options

Passing Device To Function

I'm sure this is something very simple. I'm trying to pass a device to a function but I am getting a Dimension Mismatch and type mismatch error on the function call side (not the function processing side)

Function Call
MY_FUNCTION(dvTOSEND)  //Error is with this code

Function Code
DEFINE_FUNCTION MY_FUNCTION(DEV dDEVICE[])
{
    send_string dDEVICE, "String to Send"
}

Comments

  • Options
    ericmedleyericmedley Posts: 4,177
    Take out the [ and ].

    The brackets imply you're sending a DEV array
  • Options
    amclainamclain Posts: 41
    The compiler is complaining because you've told the function to expect an array of devices, signified with the brackets on dDevice[]. If you drop the brackets it should work the way you want it to, accepting a single device.

    Like this:
    DEFINE_FUNCTION MY_FUNCTION(DEV dDEVICE)
    {
        send_string dDEVICE, "String to Send"
    }
    
  • Options
    jabramsonjabramson Posts: 106
    That worked, thanks (I knew it was something simple).
Sign In or Register to comment.