lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Daurnimator <quae@daurnimator.com>于2016年12月3日周六 下午6:20写道:
This is because coroutine.create just pushes the function onto the new
thread's stack: the first resume does the actual work.
So for this case, I guess what you're asking for is a way to inspect a
lua thread's stack from lua itself.
This wouldn't be a terrible addition to the debug.* api.


I wrote a small tool to detected memory leaks in lua VM  (https://github.com/cloudwu/lua-snapshot) ,
It's hardly implement a pure lua version like this to traverse the whole lua vm to find out all of the lua objects,
or do some hot update to replace some functions to new version.

So I suggest add an api to coroutine.* or debug.* to get the value on thread's stack.