lua-users home
lua-l archive

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


On Dec 18, 2007 9:45 AM, Tony Paloma <drunkenf00l@hotmail.com> wrote:
> Thank you, this worked. Also, GetLuaState() is inlined so declaring it at
> the top would make no difference.
>
> I'm not very good with Lua's C interface so perhaps you could help me
> understand this. The first line you gave me is pretty self explanatory, but
> what is pushliteral doing? And then why do we get and remove the 2nd item on
> stack?

lua_pushliteral is putting "Call" onto the stack, and lua_gettable is
replacing it with hook["Call"]. (lua_getfield does the same thing as
these two functions, but is (slightly) slower.) The second item on the
stack is the "hook" table, which is removed here since it's worth
getting into the habit of remove stuff you no longer need from the
stack, as it has a limited capacity.