Re: Resetting a table back to it's original values
Posted: Sun Oct 05, 2014 7:07 am
This was literally the simplest thing. Everyone else was listing the most complicated ways lol. Thanks everyone for responding!Robin wrote:Note that ivan's copy functions crash if you pass a table with cycles.
Now, what you probably want is none of this, but just a reset function:
Then you can simply call player.Reset().Code: Select all
player = {} function player.Reset() player.x = 10 player.y = 636 player.width = 80 player.height = 80 player.speed = 300 player.xVel = 0 player.yVel = 0 player.jumpVel = -800 player.score = 0 player.lives = 3 player.state = "stand" end player.Reset()