lua-users home
lua-l archive

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

2014-10-17 21:13 GMT+02:00 Roberto Ierusalimschy <>:
>> I have a program with many instances of
>>     error(msg)
>> where msg is each time some expression.
>> If this expression evaluates to a non-string,
>> the error message is merely
>>     lua: (error object is not a string)
>> There are obviously plenty of easy workarounds,
>> but is there some deep reason why the traceback
>> is omitted?
> The traceback is not added to the final message (when it is being
> printed), but to the error object itself (among other reasons because
> the traceback is created before the error is actually raised, while the
> stack is still alive). When the error object is not a string, it seems
> tricky to append a traceback into it.

Maybe 'nil' could be treated differently from other nonstrings,
and error() be allowed.