Reset transform stack?

Issue #1248 resolved
Kyle McLamb
created an issue

In the course of writing a game, sometimes I make mistakes. That's fine, because I can just run my game in protected mode, reset some things, and start again to recover.

The one error that gums the works in this system is the max stack depth error, which happens when I forget to pop something I pushed, and sticks around even after I call Since reset is useful without tossing the stack, maybe an extra function like could help?

Comments (10)

  1. Kyle McLamb reporter

    This is for live editing stuff: I don't plan to ship with, but it'd be nice if I didn't have to restart my game all over for one specific mistake

  2. Raidho

    In meantime you can try the following:

    _lgpush, _lgpop, _counter =,, 0 = function ( ) _counter = _counter + 1; _lgpush ( ) end = function ( ) _counter = _counter - 1; _lgpop ( ) end = function ( ) while _counter > 0 do ( ) end
  3. M D

    Alternatively, you can do this.

    function resetTransformStack()
        while pcall(function() end) do end

    This pops the stack until it encounters an error, and then it discards the error immediately.

  4. Bart van Strien

    Replace"all") with (resolves #1248 again)

    The pop("all") api was a bit awkward, especially considering there's a push("all") that does something else. I think any use case that benefited from pop("all") benefits from getStackDepth just as much if not more. There is also additional functionality, like being able to find the source of a mismatched push/pop.

    → <<cset e04219677926>>

  5. Log in to comment