Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Extend and clean up a clua debug function
For `crawl.stack()`, allow passing a coroutine as an argument, so that we can examine its stack instead of the current clua one. This is necessary for debugging something like qw, which wraps its main execution in a coroutine. I use standard lua functions for checking when an argument is a lua "thread" (lua's terminology for coroutines) and converting a coroutine into a lua state. The approach used in this commit is modeled on what the `debug` library `stacktrace()` function does to examine coroutines, as seen here: https://github.com/crawl/crawl-lua/blob/master/src/ldblib.c#L99 I've tested this with qw, and it works as expected. This commit also removes the request in the call `lua_getinfo()` for the number of upvalues, since this isn't used. It also fixes up and completes the lua documentation of `crawl.stack()`. Resolves crawl#2677.
- Loading branch information