[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: "chunk name" for coroutines
- From: Matias Guijarro <matias.guijarro@...>
- Date: Sun, 24 Feb 2008 13:45:16 +0100
Hello :-)
I have got a question : is it possible to specify a "chunk name"
for code being executed as the body of a Lua coroutine, in order
to get a more relevant traceback message in case of error ?
For example :
Lua 5.1.1 Copyright (C) 1994-2006 Lua.org, PUC-Rio
> c=coroutine.create(function() local a=1 print(a) coroutine.yield()
a.x=nil end)
> print(coroutine.resume(c))
1
true
> print(coroutine.resume(c))
false stdin:1: attempt to index local 'a' (a number value)
> print(debug.traceback(c))
stack traceback:
stdin:1: in function <stdin:1>
>
I would like to have a name I choose instead of "stdin".
After all, the error is inside the coroutine, not in the main
Lua state.
Does anybody know how to do that ?
Thanks in advance !
Matias.