'Clear Output' button should empty existing global variables within command bar scope

Currently, assigning variables from the command bar without using the local keyword will store those variables in the environment’s namespace:

As you can see in the video, pressing the broom-sweep button to clear the output does get rid of the visible text, but does not clear the console’s namespace of previously assigned global variables.

It would make sense for this namespace to be reset when the console is cleared deliberately like this.

2 Likes

Nah, it’s very likely that you will use it again. If so, I would say an extra button.

1 Like

What if the script is still running? Maybe that should be a separate button. Alternatively, you can close the game and reopen it.

1 Like

I’m guessing you’re trying to solve a specific problem here. What workflow issue caused you to suggest this?

This feels like it can only do harm:

  • If you don’t care about the old globals then this doesn’t make any difference as you’d just have clobbered them without issue.
  • If you do care about the old globals then clearing them would get in the way.
2 Likes

I’ve been sitting here trying to imagine a scenario where my idea makes sense and I realize that I have no answer to that. This idea just seemed like a no-brainer to me until I thought it through some more. I also now know what the word clobbered means in a programming setting. Thank you for the response :smiley:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.