Without seeing your widget implementation I have have to assume based on your question that you want the contents of the $array story variable to only exist for the life-time of the widget execution.
I also have to assume (based on your question) that you are initialising the $array to an empty array at the start of the widget's code which means that any array contents generated in one call of the widget shouldn't effect the next call, unless the widget can recursively call itself.
But to answer your question about clearing out the contents of an array story variable, you can use the that in one of three ways:
1. Re-initialise the $array story variable to an empty array.
The downside of this method is that the story variable still exists at the end of the passage rendering process which means that it will eventually be added to the History (and Save) system, which serves no real purpose if the $array story variable contains temporary data.
/% Initialise the array. %/
<<set $array to []>>
/% Use the array like normal. %/
<<set $array.push("value")>>
/% Re-initialise array to delete all the elements. %/
<<set $array to []>>
2. Unset the $array story variable.
You can use the <<unset>> macro to remove the story variable from the game, which means that it won't end up being added to the History (and Save) system.
/% Initialise the array. %/
<<set $array to []>>
/% Use the array like normal. %/
<<set $array.push("value")>>
/% Remove the story variable for the game. %/
<<unset $array>>
3. Replace the $array story variable with a _array temporary variable and optionally unset it.
The temporary variable is automatically excluded from the History (and Save) system.
optionally: If the widget can recursively call itself then you could use the <<unset>> macro to remove it.
/% Initialise the temporary array, thus automatically excluding it from History. %/
<<set _array to []>>
/% Use the temporary array like normal. %/
<<set _array.push("value")>>
/% [optionally] Remove the temporary variable for the game. %/
<<unset _array>>
WARNING: All of the above code examples were written from memory and have not been tested, they may contain syntax errors.