11.04.2008 | |

clearing out an array

This seems easy and it is, but I always seem to forget it. Instead of having to recall it out of memory I thought I would add it to the blog. It's super simple code, so here it goes.

Quick Explanation:I populate an array (or group) and now I want to repopulate that array. Here's the problem. If the first time I fill up 92 elements and then I try to repopulate it with 61 I still have 31 of my old arrays populated. The trick is to go through and delete out the array prior to repopulating it.

Simple as this:

while 0 < this.arrayName.count do
delete this.arrayName[this.arrayName.count-1]
end

0 comments: