Restart Button, What does it do?

Hello. Im confused on what the “resart” button (I asume its called that) in the bottem left corner of the screen by the back and pause/play butten does. I assumed that it restarted the program entirlly but thats not what I’ve seen. Can someone please clarify what exactly it does?

@Goatboy76 That is the restart button. If you put print( in the setup() function an press restart, you’ll see the time change. What are you doing that you don’t think it’s working.

@dave1707 If a program is running and I hitt the button, it will “wipe” the screen and only the background color will have stayed the same and then nothing will happen.

@Goatboy76 I tried the restart button on several of my projects and everything starts over correctly. It’s hard to say why yours doesn’t without see the code. Is everything initialized in setup() or do you initialize some things in other functions.

@Goatboy76 I created a program that let me initialize 3 variables in the touched() function. One is a number, a table, and a string. When I start the program, they show as nil. When I touch the screen, I initialize them and they show as number, table, and string. When I hit the restart button, they are initialized to nil, which is what should happen on a restart. So I’m not sure what’s happening in your program that it doesn’t restart properly when you press restart.

The restart button doesn’t actually do a full restart, it only resets the current projects _G, clears the parameters, clears the console, and calls setup again. Sure, that sounds like it restarts everything, but maybe if you use a dependency, or physics, they won’t be restarted.

Example: If you restart a project with physics, you may find ghost objects that aren’t drawn, ones that were left over from before you restarted.

Thanks @SkyTheCoder. I forgot about the physics objects. Like I said, without seeing the code, I couldn’t say what was wrong.

@goatboy76 sometimes (I don’t know why), the program is paused after you pressed th restart button so you need to press play to make it work.

Does someone know if the restart button runs a collectGarbage ?

@RyZum same for me, most of the time (i thought always, actially)

After playing around with some matrix stuff it seems to be working. I don’t know what I did I did but it works now. Thanks.