Difference between revisions of "Setmetatable"

From GiderosMobile
(Created page with "__NOTOC__ '''Available since:''' Gideros 2011.6<br/> === Description === Sets the `metatable` for the given table. (You cannot change the `metatable` of other types from Lua,...")
 
Line 7: Line 7:
 
  This function returns table.
 
  This function returns table.
 
<source lang="lua">
 
<source lang="lua">
(table), = setmetatable(tablemetatable,)
+
(table) = setmetatable(table,metatable)
 
</source>
 
</source>
'''table:''' (table) table to set metatable to ''''''<br/>
+
'''table''': (table) table to set metatable to ''''''<br/>
'''metatable:''' (varies) value to use as metatable ''''''<br/>
+
'''metatable''': (varies) value to use as metatable ''''''<br/>
 
'''Returns''' (table) provided table<br/>
 
'''Returns''' (table) provided table<br/>

Revision as of 11:21, 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)

'table: (table) table to set metatable to '
'metatable: (varies) value to use as metatable '
Returns (table) provided table