is(var, object)

Check if the variable inherits from the specified Object.

Parameters

var

A variable for which we want to check inheritance. That variable can be of any type.

object

An Object (as defined by the Object() function)

Return value

This function returns true if the variable inherits from the specified Object, or false otherwise.

Example

Polygon = Object { -- Defines a new Object Polygon sides = 0 -- Defines a 'sides' field in Polygon } Square = Object (Polygon) -- Defines a new Object Square, inheriting from Polygon -- outputs true print(is(Square, Polygon)) -- outputs false print(is('a string', Polygon)) -- outputs true print(is(Square(), Polygon))