Difference between revisions of "Getmetatable"

From GiderosMobile
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
<languages />
+
'''Available since:''' Gideros 2011.6<br/>
'''<translate>Available since</translate>:''' Gideros 2011.6<br/>
+
'''Class:''' [[(global)]]<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/(global)|(global)]]<br/>
 
  
=== <translate>Description</translate> ===
+
=== Description ===
<translate>If object does not have a metatable, returns nil. Otherwise, if the object's metatable has a "__metatable" field, returns the associated value. Otherwise, returns the metatable of the given object.</translate>
+
Returns the metatable of the given object.
 
<source lang="lua">
 
<source lang="lua">
 
(table) = getmetatable(object)
 
(table) = getmetatable(object)
 
</source>
 
</source>
  
=== <translate>Parameters</translate> ===
+
*if ''object'' does not have a metatable, returns nil.
'''object''': (object) <translate>Object from which to get metatable</translate> <br/>
+
*if the ''object'' metatable has a "__metatable" field, returns the associated value.
 +
*otherwise, returns the metatable of the given ''object''.
  
=== <translate>Return values</translate> ===
+
=== Parameters ===
'''<translate>Returns</translate>''' (table) <translate>metatable</translate><br/>
+
'''object''': (object) object from which to get metatable<br/>
 +
 
 +
=== Return values ===
 +
'''Returns''' (table) metatable<br/>
  
 
{{(global)}}
 
{{(global)}}

Revision as of 21:58, 13 May 2022

Available since: Gideros 2011.6
Class: (global)

Description

Returns the metatable of the given object.

(table) = getmetatable(object)
  • if object does not have a metatable, returns nil.
  • if the object metatable has a "__metatable" field, returns the associated value.
  • otherwise, returns the metatable of the given object.

Parameters

object: (object) object from which to get metatable

Return values

Returns (table) metatable