Eufloria > Eufloria Classic Mods

[error]exception indexing '20'

<< < (2/2)

Breakord:

--- Quote from: Aino on February 07, 2013, 10:35:58 PM --- The returned value from Seedlings() is an array, which means you can put it directly in as an array rather than picking out every single seedling "manually".

--- End quote ---
Yes, I know, the reason I didn't is that the array is a userdata value, if put it directly in as an array like
"SeedlingsInBattle[\i][j]=a:Seedlings(j)"
I can't use function "table.getn(Array)" to get the length of SeedlingsInBattle[\i][j] ..
Back on topic, I think Pilchard is right, but I dont know how to prove it.
The error seems to be inevitable, so I am thinking about something like"on error resume next".

Aino:

--- Quote from: Breakord on February 10, 2013, 09:24:45 AM ---Yes, I know, the reason I didn't is that the array is a userdata value, if put it directly in as an array like
"SeedlingsInBattle[\i][j]=a:Seedlings(j)"
I can't use function "table.getn(Array)" to get the length of SeedlingsInBattle[\i][j] ..
Back on topic, I think Pilchard is right, but I dont know how to prove it.
The error seems to be inevitable, so I am thinking about something like"on error resume next".

--- End quote ---

I don't think that's the cause, but you can prove it by testing it. Just create a map with two asteroid, and one which has seedlings and you simply move your seedlings from one asteroid to the other. Try different distances between the asteroid, some factors may come in to count?
I don't this it's the cause tough,since if a seedling leaves the asteroid, it won't be counted as on it anymore and the seedling should be erased from the array.

One thing you can do, when adding them to the array, is to simply check if they are nil values, also try using the "assert" function when checking them. It MIGHT work :)

Breakord:

--- Quote from: Aino on February 10, 2013, 09:50:29 AM ---I don't think that's the cause, but you can prove it by testing it. Just create a map with two asteroid, and one which has seedlings and you simply move your seedlings from one asteroid to the other. Try different distances between the asteroid, some factors may come in to count?
I don't this it's the cause tough,since if a seedling leaves the asteroid, it won't be counted as on it anymore and the seedling should be erased from the array.
One thing you can do, when adding them to the array, is to simply check if they are nil values, also try using the "assert" function when checking them. It MIGHT work :)

--- End quote ---
Thanks~:)

Breakord:

--- Quote from: Aino on February 10, 2013, 09:50:29 AM ---I don't think that's the cause, but you can prove it by testing it. Just create a map with two asteroid, and one which has seedlings and you simply move your seedlings from one asteroid to the other. Try different distances between the asteroid, some factors may come in to count?
I don't this it's the cause tough,since if a seedling leaves the asteroid, it won't be counted as on it anymore and the seedling should be erased from the array.
One thing you can do, when adding them to the array, is to simply check if they are nil values, also try using the "assert" function when checking them. It MIGHT work :)

--- End quote ---
By the way, there is no nil value in arrays in lua...when you try to get a null element, an exception will occur "exception indexing '20'".
It is different with trying to get a undefined variable, which an error will occur "a nil value".
So it is impossible to check if it is the end of the array through checking if the value is nil..
:)

Navigation

[0] Message Index

[*] Previous page

Go to full version