Wrong argument number when passing a custom type.

More
2 days 20 hours ago #79 by fefa
Hi.

I get "Wrong argument number" error when calling a function when passing a custom type.

For example this code compiles without errors:
Code:
type midiEvent {     byte t;     byte ch;     byte p1;     byte p2;     }; midiEvent mE = { 1, 2, 3, 12 }; byte t = mE.t; if(t==1){     drawSlider(slider1, mE.p2); }

but if change the if condition like this (now instead of using an intermediate variable, we access the field directly in the custom type):
Code:
if(mE.t==1){     drawSlider(slider1, mE.p2); }

then the error arises.

The only way to make it compile and work is this (expanding every custom type field):
Code:
if(mE.t==1){   drawSlider(slider1.x,slider1.y,slider1.size,mE.p2); }

I have attached the full example code.

TIA.

Please Log in or Create an account to join the conversation.

Time to create page: 0.148 seconds
Powered by Kunena Forum