[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: An introduction to Lua
- From: Dibyendu Majumdar <mobile@...>
- Date: Sun, 22 Oct 2017 02:15:56 +0100
On 22 October 2017 at 01:14, Charles Heywood <firstname.lastname@example.org> wrote:
>> Tracebacks (and the debug API) show the name of the variable that
> referenced the function.
> It depends. With Lua 5.3, I tried to set `string.gsub` to a value `x` and
> test some things with it. Invalid argument and other errors gave an
> error with the function `x`, but the traceback showed it was an error
> with the function `string.gsub`. So, the function does have a name
> associated with it, but it does also include the name used when
> referencing that function. The traceback - at least with Lua 5.3.1 -
> will show that the error happens when the value with the associated
> name is called, but it shows that the error is in the function with the
> original name.
Even so the function itself has no name, Lua is simply telling you the
name of the variable. In fact in this case, the real function is a C
function named 'str_gsub'.
It is a very good illusion of course.