[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Confusing wording in manual (function `error`)
- From: Ahmed Charles <acharles@...>
- Date: Wed, 20 May 2020 13:35:37 +0000
> 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.