lua-users home
lua-l archive

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


OK, I think I follow that.  And in the following case, when
the new chunk is loaded, it gets the global table (which has
changed) rather than inheriting the environment of the
caller?

    lua_dostring(L,
          "x=1\n"
          "reset_globals()\n"
          "y=x\n"
          "assert(loadstring('print(x,y) y=2'))()\n"
          "print(x,y)"
    );

Seems like this could cause some wierd things to happen.
Anything further to help qualify this as documented /
undocumented / bug / feature?

Thanks,
Bruce

"Mark Hamburg" <mhamburg@adobe.com> wrote in message
BCF22BBB.2CE85%mhamburg@adobe.com">news:BCF22BBB.2CE85%mhamburg@adobe.com...
> I believe the answer is that you've redefined the globals
for C functions
> but you haven't changed the global environment for the
compiled chunk.
>
> Mark
>
>