[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: lua_xmove
- From: "Jeffrey Williams" <jwilliams@...>
- Date: Tue, 26 Jul 2005 06:13:52 -0400
I've been using lua_xmove to allow one lua_State to call functions in
another lua_State, but I am concerned that what I am doing is not a
legitimate usage of lua.
Here are some more specifics... the two lua_State's involved are not lua
"threads", they are two separate states created by two calls to
lua_Open/lua_dofile
I do something like this:
lua_getglobal(L, "myfunc"); // on top of stack now resides a function
lua_xmove(L, L2, 1);
lua_pushnumber(L2, 23);
lua_pcall(L2, 0, 0, 0); // call myfunc(2) in L from state L2
It seems to work, but I am concerned that perhaps I am misusing the api and
that it only works in certain cases. So my question is: Is this proper
usage or is it just luck that it doesnt crash on me?
Jeff