That's something I'd never considered! The only way to call a Lua function from C is by name, using pd->lua->callFunction(const char* name, int nargs, const char** outerr)
. The only thing that comes to mind is you could put the callback functions in a table indexed by a token of some sort and pass the token to your C code. To call back, the C code hands the token to a named function that then pulls the function out of the table and calls it with any arguments that were passed with the token.
I've filed an issue to add a way to call a lua function on the stack. Maybe I'll finally get around to rebuilding that entire interface, either figure out how to abstract away the stack entirely or just put all of lua.h in there. Dang. Now that I'm looking at it again.. lua.h isn't that big. I probably should have gone that way from the beginning