Setting the Type


#1

basic question again.

I wonder if it is necessary to set the type in this case. In the first code below I do not set the type for ZTCellHeight

	arg6[0].type = VAR_STRING;
	arg6[0].string = (char *)gSite.Alloc(100);
	strcpy_s(arg6[0].string, 100, "ZT Cell Height");
	arg6[1].type = VAR_FLOAT;	arg6[1].val = 20.0f;
	arg6[2].type = VAR_FLOAT;	arg6[2].val = 5.0f;
	arg6[3].type = VAR_FLOAT;	arg6[3].val = 200.0f;
	arg6[4].type = VAR_FLOAT;	arg6[4].val = 1.0f;
	arg6[5].type = VAR_FLOAT;	arg6[5].val = 0.0f;
	AmiVar ZTCellHeight = gSite.CallFunction("Param", 6, arg6);

here I do set the type for ZTCellHeight:

	arg6[0].type = VAR_STRING;
	arg6[0].string = (char *)gSite.Alloc(100);
	strcpy_s(arg6[0].string, 100, "ZT Cell Height");
	arg6[1].type = VAR_FLOAT;	arg6[1].val = 20.0f;
	arg6[2].type = VAR_FLOAT;	arg6[2].val = 5.0f;
	arg6[3].type = VAR_FLOAT;	arg6[3].val = 200.0f;
	arg6[4].type = VAR_FLOAT;	arg6[4].val = 1.0f;
	arg6[5].type = VAR_FLOAT;	arg6[5].val = 0.0f;
	AmiVar ZTCellHeight; ZTCellHeight.type = VAR_FLOAT;
	ZTCellHeight = gSite.CallFunction("Param", 6, arg6);

however, they both seem to work and I didn’t get problems so far. Could someone maybe comment what best to use?

thanks, Ed


#2

No, you don’t need to do that because CallFunction returns entire variant structure (i.e. value AND type)


#3

thanks for your reply, Tomasz