lua-users home
lua-l archive

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



On 24-Aug-05, at 9:53 AM, Chris Marrin wrote:

This gets the desired field out of the env table. If it is nil that means it does not exist in that table, which makes sense. But then you test to see if that value is the same as the environment. Is that right? I don't see how that can work. Wouldn't this test actually want to test -2 against the LUA_ENVIRONINDEX?

Oops. Quite right. -1 is correct in setenvfield, but not in getenvfield.

- CodeSnippetThree: It looks like you leave a value on the stack. Is that intended?

Where, exactly?

Both of these were abstracted out of a more complex binding library, so I haven't actually tried them. I'll try to post the real code (which actually works, I think) later today.


After reading all this I am still confused about what the environment table in a userdata does. Is it just a place to store a table that can be retrieved and manipulated, or does it actually come to play in some API calls somewhere? As I mentioned, I don't see it being used anywhere in the 5.1 API. Sorry about being dense, but I really think this will solve a lot of problems for me, so I really want to understand it well.

Me, too. :)