LUA_SETFENV(3) Library Functions Manual LUA_SETFENV(3)

lua_setfenvpops a table from the stack and sets it as the new environment for the value, function indicator [-1, +0, -]

#include <lua.h>

int
lua_setfenv(lua_State *L, int index);

() pops a table from the stack and sets it as the new environment for the value at the given index.

If the value at the given index is neither a function nor a thread nor a userdata, lua_setfenv() returns 0. Otherwise it returns 1.

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

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

July 15, 2022 Debian