lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> >
> > I made several updates, so it certainly could use an extra review. So
> > please let me know if you find any errors or have comments
> >
> 
> luaState *L1;
> 
> int saveState(luaState *L) {
>    L1=L;
>    return 0;
> }
> 
> Can another routine, called later, use the save pointer L1?

Not safely. Because the coroutine it refers to might by dead (either ended or in an error state). If you want to do this, create a new coroutine in your c library (anchor it in the registry), solely for the purpose of callbacks.
Make sure to call it only using protected calls to prevent it from accidentally dying in an error state (and don't call it after the mainthread/luastate ended).