[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: An introduction to Lua
- From: Charles Heywood <vandor2012@...>
- Date: Sun, 22 Oct 2017 00:14:29 +0000
> Tracebacks (and the debug API) show the name of the variable thatreferenced 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
I've attached an example script if you want more of a reference.
On 22 October 2017 at 00:50, Eduardo Ochs <firstname.lastname@example.org> wrote:
>> Functions in Lua are values stored in variables; in particular functions do not have names
> Tracebacks can sometimes determine, or guess, function names. I think
> I never saw a description in english of the algorithm that is used for
> that, though...
Tracebacks (and the debug API) show the name of the variable that
referenced the function.
x = string.gsub