Type

From GiderosMobile
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Available since: Gideros 2011.6
Class: (global)

Description

Returns the type of its only argument, coded as a string.

(string) = type(v)

The possible results of this function are:

  • "nil" (a string, not the value nil)
  • "number"
  • "string"
  • "boolean"
  • "table"
  • "function"
  • "thread"
  • "userdata"

Parameters

v: (any) value to get type from

Return values

Returns (string) type of the variable

Example

Checks if variable x is of type table

local x = {}
if type(x) == "table" then print("type is table")
else print("type is not table")
end