Skip to main content

setfenv

Sets the environment of the given function to the given table.

setfenv(stack, env: table): function

Arguments

NameDescriptionType
stackThe function to set the enviroment of. Can also be a number that specifies the function at that stack level: Level 1 is the function calling it.function
envThe new environment of the function.table

Returns function