lua-users home
lua-l archive

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

On Fri, Oct 2, 2015 at 1:51 PM, Patrick Donnelly <> wrote:
> On Fri, Oct 2, 2015 at 4:48 PM, Patrick Donnelly <> wrote:
>> On Fri, Oct 2, 2015 at 3:25 PM, Dirk Laurie <> wrote:
>>> 2015-10-02 20:54 GMT+02:00 Parke <>:
>>>> Egor's original suggestion was that a warning be added to the REPL to
>>>> alert new users of the schism.  A REPL warning in response to
>>>> singleton statements of the form "local namelist [‘=’ explist]" seems
>>>> like a good idea to me.
>>> The difficulty is that this is not a simple matter of changing
>>> a few lines in lua.c. One needs functionality equivalent to
>>> luac to diagnose the situation.
>> It's simpler than that. You can use lua_getlocal to determine if the
>> chunk defined any locals.
> Nevermind, no you can't. When you run lua_getlocal on a closure, you
> only get information about its parameters. I thought there was an API
> to get the local count but I guess not...

lua_gettop() is basically that.

But as I was suggesting, use a debug hook -- it'll fire after the
contents of the input are executed, but before the chunk returns.

/s/ Adam