14 Aug 2012 01:29
Passing lua state in struct in c
Digital <forumme5487 <at> live.com>
2012-08-13 23:29:39 GMT
2012-08-13 23:29:39 GMT
How can I pass a lua state in a struct to a function or thread in c/c++?
I tried:
//----------------------
lua_State *L;
struct sargs {
lua_State *L;
char *arg2;
};
void *runlua(void *arg)
{
char *dat;
struct sargs *args = (struct sargs*)arg;
lua_State *L = (lua_State *) args->L;
dat = args->arg2;
return NULL;
}
int main()
{
// Init the regular lua stuff:
struct sargs pargs;
pargs.L = L;
pargs.arg2 = "pass data";
return 0;
}
But with that I am unable to retrieve the lua state. Or through a
created thread passing the struct as argument.
RSS Feed