Difference between revisions of "Setfenv"

From GiderosMobile
Line 3: Line 3:
 
'''<translate>Available since</translate>:''' Gideros 2011.6<br/>
 
'''<translate>Available since</translate>:''' Gideros 2011.6<br/>
 
'''<translate>Class</translate>:''' [[Special:MyLanguage/(global)|(global)]]<br/>
 
'''<translate>Class</translate>:''' [[Special:MyLanguage/(global)|(global)]]<br/>
 +
 
=== <translate>Description</translate> ===
 
=== <translate>Description</translate> ===
 
<translate>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.  
 
<translate>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.</translate>
 
  As a special case, when f is 0 setfenv changes the environment of the running thread. In this case, setfenv returns no values.</translate>
Line 11: Line 11:
 
(varies) = setfenv(f,table)
 
(varies) = setfenv(f,table)
 
</source>
 
</source>
 +
 
=== <translate>Parameters</translate> ===
 
=== <translate>Parameters</translate> ===
 
'''f''': (varies) <translate>function or number(call stack level)</translate> <br/>
 
'''f''': (varies) <translate>function or number(call stack level)</translate> <br/>
 
'''table''': (table) <translate>environment table to set</translate> <br/>
 
'''table''': (table) <translate>environment table to set</translate> <br/>
 +
 
=== <translate>Return values</translate> ===
 
=== <translate>Return values</translate> ===
 
'''<translate>Returns</translate>''' (varies) <translate>returns provided function or nil</translate><br/>
 
'''<translate>Returns</translate>''' (varies) <translate>returns provided function or nil</translate><br/>
 +
 +
{{(global)}}

Revision as of 04:29, 11 February 2020


Available since: Gideros 2011.6
Class: (global)

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