LoginLogin

Restore & Read vs One big array?

Root / Programming Questions / [.]

Gaelstrom_ValenceCreated:
What do you think is more like, database stuff. Like I've been using Restore and Read to retrieve collision box sizes (for tile checking, E.G. Read BoxStartx,BoxStarty,BoxWidth,BoxHeight), I think Arcanum stone does the same for SPCHR stuff or hitboxes or something, and I mean it does so in the main program loop. Now. What advantages or disadvantages would say, doing 1 round of Restores and Reads during initializing, and putting all that data in an array to refer to?

I'm not sure there is any advantage to using an array, in this case RESTORE/READ seems to be faster, and more readable

I'm not sure there is any advantage to using an array, in this case RESTORE/READ seems to be faster, and more readable
In my test, Restore and Read has been faster... Except when it comes to well... Getting the string variable to Restore the right label. Seems to slow things down quite a bit for me. ... Until I happened to look up your Format guide. I guess STR$() additions is particularly slow, using format helped out alot there for speed. Thank you for that good sir. The array setup still seems to be marginally quicker for me... Although I'm kind of thinking I just messed up with something there.

Oh yeah, another benefit to Restore/Read. I mean, as far as I can tell you can't check if you're going to go out of bounds in an array without say, having another variable keep track of the maximum values within them? But when you're using Restore, you can just use CHKLABEL beforehand to make sure it exists.

You can just use LEN() to check the length of an array READ can still cause an error if there isn't enough DATA, and there's no way to test for that. But as long as your DATA is formatted correctly, it's fine.

You can just use LEN() to check the length of an array READ can still cause an error if there isn't enough DATA, and there's no way to test for that. But as long as your DATA is formatted correctly, it's fine.
What if the array is multidimensional?