Garry's Mod Wiki

istable

  boolean istable( any variable )

Description

Returns if the passed object is a table.

Will return true if the argument has a metatable. It will return true for variables of type Color as well.

Arguments

1 any variable
The variable to perform the type check for.

Returns

1 boolean
True if the variable is a table.

Example

Second object has a string conversion but it is still a table

local mt1 = {} function new1() self = {}; setmetatable(self, mt1) mt1.__index = mt1 return self end local mt2 = {} function new2() self = {}; setmetatable(self, mt2) mt2.__index = mt2 mt2.__tostring = function(o) return "TEST" end return self end
Output:
table: 0x01c98390 true TEST true table: 0x019f29f8 true