generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: What exactly does getfenv do?

Previous Thread :: Next Thread 
Luxurize is not online. Luxurize
Joined: 31 Mar 2015
Total Posts: 1289
17 Sep 2015 12:11 PM
I'm not entirely sure on what it does, how it can be used.


“Insane isn't always black or white. We're all pathological, in our own ways.”
Report Abuse
Sebery is not online. Sebery
Joined: 05 Apr 2014
Total Posts: 182
17 Sep 2015 12:15 PM
http://wiki.roblox.com/index.php?title=Function_dump/Basic_functions#getfenv

There are some Informations about the GetFenv Method (Never knew about that)



Im useless, youre useless, were all useless.
Report Abuse
chimmihc is not online. chimmihc
Joined: 01 Sep 2014
Total Posts: 17143
17 Sep 2015 12:22 PM
It returns the environment of the level passed as an arg.


Muad'Dib
Report Abuse
Luxurize is not online. Luxurize
Joined: 31 Mar 2015
Total Posts: 1289
17 Sep 2015 12:24 PM
So it returns the environment of the script?


“Insane isn't always black or white. We're all pathological, in our own ways.”
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
17 Sep 2015 12:26 PM
getfenv(< function, int > Env = 1) -> table Environment

Given a function or integer, it returns the environment for that function or stack level. Give it 0, and it returns the global environment.
Report Abuse
TickerOfTime is not online. TickerOfTime
Joined: 02 Sep 2012
Total Posts: 2030
17 Sep 2015 12:31 PM
In layman's terms, it returns an array of all the global variables for a specified function or scope. Default scope is 1.
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
17 Sep 2015 12:32 PM
it returns an array [...]

Now let me just stop you right there...
Report Abuse
TickerOfTime is not online. TickerOfTime
Joined: 02 Sep 2012
Total Posts: 2030
17 Sep 2015 12:37 PM
Well, it is an array.
Report Abuse
chimmihc is not online. chimmihc
Joined: 01 Sep 2014
Total Posts: 17143
17 Sep 2015 12:41 PM
Inside any script.

print(getfenv().script) --> some name

Environments are not arrays.


Muad'Dib
Report Abuse
Luxurize is not online. Luxurize
Joined: 31 Mar 2015
Total Posts: 1289
17 Sep 2015 12:56 PM
function Nothing() return end
setfenv(Nothing, {print("This works.");});
for i,c in pairs(getfenv(Nothing)) do
print(c);
end
> "This works."



“Insane isn't always black or white. We're all pathological, in our own ways.”
Report Abuse
chimmihc is not online. chimmihc
Joined: 01 Sep 2014
Total Posts: 17143
17 Sep 2015 01:05 PM
"function Nothing() return end
setfenv(Nothing, {print("This works.");});
for i,c in pairs(getfenv(Nothing)) do
print(c);
end"

That is setting the environment of Nothing to an empty table, print doesn't return anything.

Muad'Dib
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image