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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
| |
|
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
|
  |
| 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
|
  |
| 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 |
|
|