structs and stings
Displaying 1-3 of 3 total.
1
Please enter a numerical value for the importance of this sticky.
Enter 0 to unsticky.
RageCage

I'm getting a weird no error-crash in verge. lets set up a hypothetical situation:


struct blah{
string name;
}

blah temp[20];
blah temp2;

void Caca(){
temp2.name = temp[1].name; //crash!
}


and temp[1].name does have data assigned name, what's interesting is that if you change name into an int, it will work with out crashing.

is this a verge error? or am I doing something wrong?

Posted on 2004-05-30 06:15:24

el_desconocido

[After testing a bit, the original comments have been deemed useless. However:]

It seems as though if some structs are declared as arrays, all must be, try the following:

struct blah{

string name;
}

blah temp[20];
blah temp2[1];

void Caca(){
temp2[0].name = temp[1].name; // no crash!
}

// in autoexec:
temp[1].name = "crap2";
temp2[0].name = "crap";
log("temp2[0].name = " + temp2[0].name);
Caca(); // temp2[0].name = temp[1].name;
log("temp2[0].name = " + temp2[0].name);

// from log:
temp2[0].name = crap
temp2[0].name = crap2
Note that it did not crash, and ran other code after this and exitted normally upon alt+X.

El

PS: Perhaps it simply does not like assigning between struct arrays and non arrayed structs.

Posted on 2004-05-30 06:38:06 (last edited on 2004-05-30 07:24:34)

RageCage

ahh thank you much sir

Posted on 2004-05-30 07:48:55


Displaying 1-3 of 3 total.
1
 
Newest messages

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.