lua_setfenv

Function lua_setfenv 

Source
pub unsafe extern "C-unwind" fn lua_setfenv(
    L: *mut lua_State,
    idx: c_int,
) -> c_int
Expand description

Sets the environment of the value at the given index to the value at the top of the stack.

This function will set the environment of the value at the given index to the value at the top of the stack, and pop the value from the stack.

Only functions and threads have environments, so this function will only work for those types.

This function will return 1 if the environment was set successfully, and 0 if the value at the given index does not have an environment.