Hey,

I've been having some problems with a script of mine, here's a relevant bit of the code:
Code:
STRING* arrlanguage[1000];
var i_lang 		= 0;

// A function to set a config value
function SetConfigStr(STRING* cType, STRING* key, STRING* val)
{
	if(str_cmpi (cType, "[language]")){
		str_cpy(arrlanguage[i_lang], key);



And here's how I call it:
Code:
while(file_str_read(fhandle,fileBuffer) != -1)
	{
		var end = str_stri(fileBuffer,"\n");
		var ass = str_stri(fileBuffer,"=");
		fileBuffer = str_cut(NULL,fileBuffer,1,end - 1);
		
		if(str_cmpi (fileBuffer, "[language]") || str_cmpi (fileBuffer, "[graphics]") || str_cmpi (fileBuffer, "[sound]") || str_cmpi (fileBuffer, "[controls]")){
			str_cpy(lastSection, fileBuffer);
		}else{
			STRING* key;
			STRING* val;
			
			key = str_cut(NULL,fileBuffer,1,ass - 1);
			val = str_cut(NULL,fileBuffer,ass + 1,end - 1);
			
			SetConfigStr(lastSection, key, val);
		}
	}



I know for a fact the problem lies in this bit "str_cpy(arrlanguage[i_lang], key);" where the array element is the invalid argument.

I'd expect that if I create the array as a STRING*, each of it's elements will have the same type obviously.

But I keep getting this error:
Error E1515: Invalid arguments in SetConfigStr
for every time it loops through a line from the configuration

Halp.

Last edited by TheJjokerR; 09/21/11 10:59.