[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: How catch new globals?
- From: "J. Perkins" <starkos@...>
- Date: Fri, 28 Oct 2005 17:03:44 -0400
This is my first foray back into Lua since the 4.0 days...quite a bit
has changed I see. I am porting some old code to Lua 5 and I'm stuck
trying to replace a "getglobal" tag method.
My 4.0 code looked like this:
lua_settagmethod(L, LUA_TNIL, "getglobal");
For 5.0 I tried to do this:
But my function never gets called. I also tried "index", "__newindex",
and "__index", but no avail.
FYI, what I am trying to do is catch statements of the form:
package.name = "MyPackage"
...where `package` hasn't been defined yet. My function will create a
table, populate a few values, and then setglobal("package") before
I'm sure this is easy, but I couldn't seem to come up with the right
Google words to find an answer. Perhaps it is so basic and obvious
that no one else needed to ask :p
Thanks for the help,