lua-users home
lua-l archive

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

2015-03-05 3:11 GMT+02:00 Dave Hayden <>:
> On Mar 4, 2015, at 5:02 PM, Dave Hayden <> wrote:
> Is there some new way of getting a stack trace when lua fails an assert?

Whenever I write in the C API, I cruise along happily without brakes
until I get my first segmentation error.

Then I include the following code (5.2) in my program:

static void stackprint(lua_State *L, int from) {
   int top=lua_gettop(L);
   while (from<=top)
      printf(" %i",luaL_checkint(L,from++));

and sprinkle calls to it liberally in the region of the failed assert.
It needs to be modified for 5.3 (no luaL_checkint) anyway, so
one might as well change the print line to print other things than