LUA_NEWTHREAD(3) Library Functions Manual LUA_NEWTHREAD(3)

lua_newthreadcreates a new thread, function indicator [-0, +1, m]

#include <lua.h>

lua_State *
lua_newthread(lua_State *L);

() creates a new thread, pushes it on the stack, and returns a pointer to a lua_State(3) that represents this new thread. The new state returned by this function shares with the original state all global objects (such as tables), but has an independent execution stack.

There is no explicit function to close or to destroy a thread. Threads are subject to garbage collection, like any Lua object.

lua_newthread() returns a pointer to a lua_State(3) that represents this new thread.

lua_State(3)

Roberto Ierusalimschy, Luiz Henrique de Figueiredo, and Waldemar Celes, Lua 5.1 Reference Manual.

The lua_newthread() manual page is based on Lua Reference Manual 5.1 and was created by Sergey Bronnikov.

July 15, 2022 Debian