Difference between revisions of "Setmetatable"
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 ''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.</translate> | This function returns table.</translate> | ||
Line 11: | Line 11: | ||
(table) = setmetatable(table,metatable) | (table) = setmetatable(table,metatable) | ||
</source> | </source> | ||
+ | |||
=== <translate>Parameters</translate> === | === <translate>Parameters</translate> === | ||
'''table''': (table) <translate>table to set metatable to</translate> <br/> | '''table''': (table) <translate>table to set metatable to</translate> <br/> | ||
'''metatable''': (varies) <translate>value to use as metatable</translate> <br/> | '''metatable''': (varies) <translate>value to use as metatable</translate> <br/> | ||
+ | |||
=== <translate>Return values</translate> === | === <translate>Return values</translate> === | ||
'''<translate>Returns</translate>''' (table) <translate>provided table</translate><br/> | '''<translate>Returns</translate>''' (table) <translate>provided table</translate><br/> | ||
+ | |||
+ | {{(global)}} |
Revision as of 04:29, 11 February 2020
Available since: Gideros 2011.6
Class: (global)
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