lua-users home
lua-l archive

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

> > lua_newthread() does not seem to be checking its
> > state allocation (luaE_newthread->mallocstate
> > in state.c) for possible failure.
> It doesn't need to. luaM_malloc never returns NULL
> when called with a non-null lua state (it throws
> an error, instead).

This may be fine when creating a co-routine from
a Lua context. But I am calling lua_newthread from
a C context. Does that mean I should call lua_newthread
through lua_pcall if I am to prevent my application
from exiting on an error? If so, what other Lua API
functions should be treated with similar caution?