Reset button

Is it possible to have a button that when pushed resets the program?

The reload button doesn’t do that?

It does, but I want to implement my own feature in the program so that when you lose it resets automatically

@Bieber208 at the moment there is no built-in API call to reset the state of your program. It’s a good idea though.

Just wrap up your initialization code, and call it again when you want to reset state. It’s some extra bookkeeping, sure, but it’s probably good practice anyway…

@Bortels how do you do that?

Make an “init” function, and set up all of the variables you’d want to reset in there. Call it from setup(), and call it when you want to reset things. Its a bit more bookkeeping, but simple enough.

So (using LuaJump as example) when init() is called,

girl.position.y = 0
CloudLevels.nextCloudHeight = 0