lua-users home
lua-l archive

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


On Mon, Nov 30, 2009 at 1:26 AM, Duncan Cross <duncan.cross@gmail.com> wrote:
> On Sun, Nov 29, 2009 at 8:15 PM, Murray S. Kucherawy <msk@cloudmark.com> wrote:
>> I export a few C global variables and a number of C functions to the
>> scripts, and then use lua_load() to load them and check for errors.
>> However, I observed that if I insert a typo into one of the exported
>> function names, lua_load() doesn’t return an error even though that’s now an
>> unrecognized symbol.
>
> Lua is a dynamic language - new global functions and variables can be
> defined (and undefined) at any time. Because of this, there is no
> reasonable way for lua_load to know for sure whether a function will
> actually exist at a certain point in a script without running it to
> that point first. I realise this might seem unfortunate, but it is the
> nature of the thing. This is kind of the downside of so
>
> I think that returning dummy values in a dry run.
>
> I'm sorry to
>

I posted the wrong draft here! Sorry for the noise everybody :(

This is the right one:


Lua is a dynamic language - new global functions and variables can be
defined (and undefined) at any time. Because of this, there is no
reasonable way for lua_load to know for sure whether a function will
actually exist at a certain point in a script without running it to
that point first. I realise this might seem unfortunate, but it is
kind of the nature of the thing - this is a downside of some of Lua's
best features.

-Duncan