Jun-22-2018, 06:09 PM
I have a variable called "current" which is the name of the current def you are in. If you lose a life a new def is called. Since rooms are picked at random, I cant just use 'roomname()' to get back to the original room you were in before you lost a life. I need something that assignes current the as the current def name, then calls that variable in the death function like 'current()'.
I have tried this:
Any help on this would be appreciated!
Thanks, Dream.
I have tried this:
import inspect #this a test def main(): room1() def room1(): global current current = inspect.stack()[0].function dead() def dead(): current() main()but I get an error saying 'TypeError: 'str' object is not callable'
Any help on this would be appreciated!
Thanks, Dream.