Difference between revisions of "Setmetatable"

From GiderosMobile
Line 2: Line 2:
 
'''Available since:''' Gideros 2011.6<br/>
 
'''Available since:''' Gideros 2011.6<br/>
 
=== Description ===
 
=== Description ===
Sets the `metatable` for the given table. (You cannot change the `metatable` of other types from Lua, only from C.) If `metatable` is nil, removes the `metatable` of the given table. If the original `metatable` has a "__metatable" field, raises an error.  
+
<translate>Sets the [[[metatable` for the given table. (You cannot change the `metatable` of other types from Lua, only from C.) If `metatable` is nil, removes the `metatable` of the given table. If the original `metatable]]] has a "__metatable" field, raises an error.  
  
  
  This function returns table.
+
  This function returns table.</translate>
 
<source lang="lua">
 
<source lang="lua">
 
(table) = setmetatable(table,metatable)
 
(table) = setmetatable(table,metatable)
 
</source>
 
</source>
 
=== Parameters ===
 
=== Parameters ===
'''table''': (table) table to set metatable to <br/>
+
'''table''': (table) <translate>table to set metatable to</translate> <br/>
'''metatable''': (varies) value to use as metatable <br/>
+
'''metatable''': (varies) <translate>value to use as metatable</translate> <br/>
 
=== Return values ===
 
=== Return values ===
'''Returns''' (table) provided table<br/>
+
'''Returns''' (table) <translate>provided table</translate><br/>

Revision as of 13:34, 23 August 2018

Available since: Gideros 2011.6

Description

Sets the [[[metatable` for the given table. (You cannot change the `metatable` of other types from Lua, only from C.) If `metatable` is nil, removes the `metatable` of the given table. If the original `metatable]]] has a "__metatable" field, raises an error.


This function returns table.
(table) = setmetatable(table,metatable)

Parameters

table: (table) table to set metatable to
metatable: (varies) value to use as metatable

Return values

Returns (table) provided table