This is the approach I took. I couldn't find a way to get the returned callback through the lua API, so instead I passed a void*(*[1])(void*) to the new state as a lightuserdata that it could write the function pointer into. Other than that, it seems to work without any fuss! :) henk On 23 January 2013 10:21, Mike Pall <mike-1301@xxxxxxxxxx> wrote: > Hiroaki Nakamura wrote: >> How can we write that? Do we have to write that portion in C? >> Or we can write the function called from pthread_create() in lua? > > You create a separate Lua state first, then define a callback > function in *that* state and then use pthread_create() from the > original state, passing the callback address of the other state. > > --Mike >