[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Calling functions in tables in 4.0
- From: "Wim Couwenberg" <w.couwenberg@...>
- Date: Sat, 19 Apr 2003 09:50:15 +0200
Ken Paulson wrote:
> If I change the function to MyFunction (not within a table), then it
> works fine. I'm sure it's just a dumb newbie mistake, so I'd
> appreciate if someone can point out what I'm doing wrong.
In C the procedure is the same as in a Lua script:
- extract the function from the table
- call the function
/* get (global) table */
lua_pushstring(L, "MyStuff");
lua_getglobal(L);
/* get function */
lua_pushstring(L, "MyFunction");
lua_gettable(L, -2);
/* drop table */
lua_remove(L, -2);
/* call function (0 args, 0 results) */
lua_call(L, 0, 0);
Bye,
Wim