lua-users home
lua-l archive

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


> The most likely cause for this is an immediately preceding call to
> a C function from your Lua code. If this call returns an undefined
> or bad value (e.g. more than it pushes on the stack), it'll mess
> up the internal Lua stack, which may lead to a crash later on.

Ah yes indeed, I found some bad cases, I must have been blind, I never
even know about the assert mode in lua :)

> > For reference, my docall method is as follow, nothing fancy:
> Not spectacularly efficient code, but I guess this doesn't matter
> much here. Remember that lua_pushcfunction() allocates memory for
> a new closure, each time you run it. I guess it would be better to
> use debug.traceback as an error handler, anyway.

Good point!

Thanks, I'm now on the right track!