Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Can someone explain getfenv() and setfenv()?

I don't understand how it works but I know that it can set and get the environment of a function. How can it be used?

Any help is greatly appreciated!

1 comment

0

Anyone?

1 answer

The environment of a function is anything that the function has access to. getfenv() gets a table with the contents of what the function is able to access, and setfenv(function, table) can remove or add things that the function can have access to.

This discussion is preserved as it was. New answers, comments, and votes are closed.