Difference between revisions of "Setfenv"

From GiderosMobile
Line 9: Line 9:
 
(varies) = setfenv(f,table)
 
(varies) = setfenv(f,table)
 
</source>
 
</source>
'''f''': (varies) function or number(call stack level) ''''''<br/>
+
=== Parameters ===
'''table''': (table) environment table to set ''''''<br/>
+
'''f''': (varies) function or number(call stack level) <br/>
 +
'''table''': (table) environment table to set <br/>
 +
=== Return values ===
 
'''Returns''' (varies) returns provided function or nil<br/>
 
'''Returns''' (varies) returns provided function or nil<br/>

Revision as of 10:45, 23 August 2018

Available since: Gideros 2011.6

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. setfenv returns the given function.


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

Parameters

f: (varies) function or number(call stack level)
table: (table) environment table to set

Return values

Returns (varies) returns provided function or nil