lua-users home
lua-l archive

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



> On May 20, 2020, at 6:35 AM, Ahmed Charles <acharles@outlook.com> wrote:
> 
> 
> 
>> On May 19, 2020, at 3:43 AM, Lorenzo Donati <lorenzodonatibz@tiscali.it> wrote:
>> 
>> Hi Lua Team!
>> 
>> The description of `error` says:
>> 
>> "Terminates the last protected function called and returns message as the error object. This function never returns."
>> 
>> Which is quite confusing (especially for newbies).
>> 
>> I'd suggest a change like:
>> 
>> "Terminates the last protected function called and raises (throws?) an error having message as the error object. This function never returns."
> 
> The issue with raise/throw is that those tend to imply that a catch happens after, but the first word in this sentence is terminates. Terminates refers to the corresponding pcall and therefore the verb in the second half of the sentence also does, which means that pcall returns not error. The error function causes pcall to terminate and return.
> 
> Generally speaking, I prefer the terseness of the manual. It’s not meant to be a tutorial or newbie friendly.

After thinking some more, this would probably be more accurate:

Terminates the last protected function called and causes it to return message as the error object. This function never returns.

That makes the subject match on both sides of the and.