[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Passing lua state in struct in c
- From: Digital <forumme5487@...>
- Date: Tue, 14 Aug 2012 04:59:39 +0530
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.