[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: How to push function on the stack
- From: Aleksandar Fabijanic <aleskx@...>
- Date: Thu, 8 Mar 2007 18:20:41 -0800 (PST)
I'd like someone to point me to a sample source on how to push function on the stack.
For example, I can do following with a string:
const
char* code = "function
() print('hello world') end";
lua_newtable(L);
lua_pushstring(L,
"code");
lua_pushstring(L,
code);
lua_settable(L, -3);
Later, when I try to retrieve the value, it returns string as is appropriate (I am serializing/deserializing it with Pluto):
...
lua_getfield(L2, -1,
"code");
int
t = lua_type(L2, -1);
...
How would one go about pushing code as a function? And also, how do I later retrieve it? A snippet of code would be greatly appreciated.
Thanks in advance,
Alex
____________________________________________________________________________________
Be a PS3 game guru.
Get your game face on with the latest PS3 news and previews at Yahoo! Games.
http://videogames.yahoo.com/platform?platform=120121