Jump to content
  • 0
Sign in to follow this  
Shadow72

Allow arrays with empty indexes in Game Storage

Question

Since we don't have access to dictionaries right now I have been using arrays with indexes as my key and then the value at that index as my value for key value pairs. If you try to set a value of an array at index 1 but have nothing at index 0 and then set the game storage variable to it you will get a difficult error to try and track down in your code. It would be nice if we could store an array with empty fields in a game storage variable. There is also no None variable for variables which makes it more difficult to check if a index in an array is empty or not.

 

For anyone else stuck on this here is the workaround I found. Use a count with loop to count from the length of the array to the index you are going to use and set each index inbetween to 0.

Share this post


Link to post
Share on other sites

3 replies to this bug / suggestion

Recommended Posts

  • 0

You can create "empty" array by using Set Length instruction. This will add new "Undefined" cells to the array. If you want to fill the array with your own "default" values (i.e NONE) you can use the Fill instruction.

 

2020-11-02_11h58_22.png

  • Like 1
  • Thanks 2

Share this post


Link to post
Share on other sites
  • 0
On 11/2/2020 at 4:57 AM, Rudy.cz said:

You can create "empty" array by using Set Length instruction. This will add new "Undefined" cells to the array. If you want to fill the array with your own "default" values (i.e NONE) you can use the Fill instruction.

 

2020-11-02_11h58_22.png

Thank you! You way of doing it is a lot better than the loop way I came up with.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×