[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: error() or nil, 'error msg'
- From: Sean Conner <sean@...>
- Date: Wed, 10 Sep 2014 21:39:41 -0400
It was thus said that the Great Andrew Starks once stated:
>
> In practice, I find that it's hard to tell what is happening, especially in
> a coroutine, and especially if I use the `nil, error` approach. I generally
> like my errors to be loud and obvious and haven't had a ton of success with
> 'quietly moving on.'
>
> Soo..... what do smart people do?
One other thing I've done. The the one place I do call lua_pcall(), I
made sure the following function is on the stack:
function stackdump()
local stack = {}
for i = 1 , 10 do
local info = debug.getinfo(i,"Sl")
if not info then break end
table.insert(stack,string.format(" [%s(%d)]",info.source,info.currentline))
end
syslog('debug',"stack=%s",table.concat(stack))
end
It's enough to pin point the place of the crash.
-spc (Then again, I'm not using the sample lua interpreter, but have Lua
embedded in the application)