lua-users home
lua-l archive

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


2010/1/19 David Manura <dm.lua@math2.org>:
> On Tue, Jan 19, 2010 at 12:20 PM, Fabien wrote:
>>> On Sat, Jan 9, 2010 at 4:34 PM, Cosmin Apreutesei wrote: [1]
>>> > I always felt that the stack level parameter in
>>> > setfenv() and error() is just a hack, and I'm happy to see it go away.
>>
>> By reading your post, I understand that the optional level parameter in
>> error(msg, [level]) is to be deprecated, but I can't find a reference to
>> such a change. Have I missed the change or misunderstood you?
>
> I too wondered about that, but I believe that was not the intended
> implication.  Lua 5.2.0-work2 still has a level parameter in the error
> function.  In Lua 5.2.0-work2, error is the only function outside the
> debug library and C API that still deals with a level parameter.

When throwing an error, you want the user to know where in the source
the error is, not where error is called. Removing the stack index
parameter will most likely make it useless for
module/library/framework writers.