Home Contents | # setfenv | Global | Lua Commands

## SYNOPSIS

setfenv(f,table)

## DESCRIPTION

Sets the environment to be used by the given function. f can be a Lua function or a number that specifies the function at that stack level: Level 1 is the function calling setfenv.

## NOTES

As a special case, when f is 0 setfenv changes the environment of the running thread. In this case, setfenv returns no values.

## RETURN VALUE

setfenv returns the given function.