|
Re: nuremical Arrray
[Re: Darkmatters]
#320187
04/20/10 10:05
04/20/10 10:05
|
Joined: Jan 2004
Posts: 3,023 The Netherlands
Helghast
Expert
|
Expert
Joined: Jan 2004
Posts: 3,023
The Netherlands
|
I'm not sure, but try it like this:
// string to fill
STRING* arrayStr[50];
// function that creates empty strings in array
STRING* initString(STRING* inStr, int amount) {
var i;
for(i=0; i<amount; i++) {
inStr[i] = str_create("");
}
retur(inStr);
}
// make SURE you do the following inside a function, not globally :P
// call function to empty all strings before using it!
arrayStr = initString(arrayStr, 50);
// once it's initialised, you can add strings in it however you like;
arrayStr[0] = "Temp text that you can put in it.";
This is totally untested, and might not work at all... but it should give you the idea... regards,
|
|
|
Re: nuremical Arrray
[Re: Helghast]
#320191
04/20/10 10:12
04/20/10 10:12
|
Joined: Jan 2004
Posts: 3,023 The Netherlands
Helghast
Expert
|
Expert
Joined: Jan 2004
Posts: 3,023
The Netherlands
|
wow... I cant believe what an idiot I am for reading the question wrong  I'll leave the above code for anyone else, but you should be able to store data if it's only numerical values like any other variable...
// store 50 numbers
var arrayVar[50];
// it's always a good idea to fill the array before using it.
var resetArray(var tempArray, var amount) {
var i;
for(i=0; i<amount; i++) {
tempArray[i] = 0;
}
return(tempArray);
}
// again these bottom things should be done WITHIN a function, not global.
// call the function to reset the array
arrayVar = resetArray(arrayVar, 50);
// access them however you want
arrayVar[0] = 2347895;
Also untested, but am more confident that should work  regards,
|
|
|
|