Passing Multiple Parameters to Function Help?
cubegleamer
Posts: 21
First let me say that I really appreciate this community. I've already had several questions answered here and as this is how I am putting food on the table, I thank you. Im somewhat new to AMX so this will likely not be my last newbie-ish question. Heres what Im trying to do.
I have a function that Im using where I want to be able to pass in two char arrays. Im calling the function in two places, but in each of these places I only need to pass one of the char arrays. How do I go about this?
The error Im getting is:
[1] arguments for function (processdebugrequest) taking [2] arguments
I have a function that Im using where I want to be able to pass in two char arrays. Im calling the function in two places, but in each of these places I only need to pass one of the char arrays. How do I go about this?
define_function processDebugRequest (cReceivedString[],cConnectionStatus[]) { if ([vdvDebug,1]) { send_string 0,"'RX$ ClearOne:',cReceivedString" } else if ([vdvDebug,2]) { send_string 0,"''" //I will be doing something here but not now } else if ([vdvDebug,3]) { send_string 0,"'ClearOne is:',cConnectionStatus" } } data_event [dvDevice] { string: { stack_var char cReceivedString[100] cReceivedString = data.text processResponse (data.text) processDebugRequest (cReceivedString) } offline: { stack_var char cConnectionStatus[7] if (deviceInitialized) init () processDebugRequest (cConnectionStatus) } }
The error Im getting is:
[1] arguments for function (processdebugrequest) taking [2] arguments
0
Comments
I want to do stuff based on whether a channel on vdvDebug is on, but not mutually exclusive. Does that make sense? For instance if channel one is on, I want to see cReceivedString info. If channel one AND two are on, I want to see cReceivedString AND cConnectionStatus.
So, I think the "else if" is the first place I was going wrong with that.
Functions don't permanently maintain copies of their parameters from call to call, so you'd have to pass both parameters in each time you call the function.
Hope that's helpful.
-Ryan