Xandy Posted April 23, 2014 Share Posted April 23, 2014 Passing arrays with size included is very convenient for scope. I know I'm late to the party. It works great for 1 dimension arrays. I'm not sure how to do it with 2 dimensional arrays without possibly wasting memory. I may have read a long time ago that AutoIt used a pointer like system in which array indexes didn't really take up space until filled with data. local $world_size[2] $world_size[0]= 320 $world_size[1]= 320 local $world[$world_size[0]][$world_size[1]] $world[0][0]= $world_size[0] $world[0][1]= $world_size[1] ConsoleWrite($world[0][0]) I could shift the x world data to account for the size and pass the array around without xmax ymax parameter syntax. I'd still be wasting 318 units of whatever memory. I know I could make an array with 3 elements shove the [0]xmax, [1]ymax, [2]world array into it pass it around and access [2]world with a dummy variable. Is that the way I should do it? Is there something I should read to being me up to date as how this should be done? Human Male Programmer (-_-) Xandy About (^o^) Discord - Xandy Programmer MapIt (Tile world editor, Image Tile Extractor, and Game Maker) Link to comment Share on other sites More sharing options...
Solution FireFox Posted April 23, 2014 Solution Share Posted April 23, 2014 Passing arrays with size included is very convenient for scope. I know I'm late to the party. Why don't you use the UBound function? Xandy 1 Link to comment Share on other sites More sharing options...
Xandy Posted April 23, 2014 Author Share Posted April 23, 2014 (edited) Why don't you use the UBound function? It's extra call assignment line(s) for each accessing function, that I only need to assign once during a load routine. Reads cleaner to me. Fewer lines. I didn't know Ubound() had a Dimension parameter! Now I do. I will consider your advice greatly as I will probably now be using a Ubound() system. Thank you! Edited April 23, 2014 by Xandy Human Male Programmer (-_-) Xandy About (^o^) Discord - Xandy Programmer MapIt (Tile world editor, Image Tile Extractor, and Game Maker) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now