FANDOM


type( value )

Returns the basic type of a given value as a string.

value
The value whose type to test.

The type() function is similar to the corresponding Lua built-in function.

Examples Edit

print(type(1))        -- "number"
print(type("hello"))  -- "string"
print(type(false))    -- "boolean"
print(type({}))       -- "table"
print(type(nil))      -- "nil"

function print_is_number(v)
  if type(v) == "number" then
    print("it's a number")
  else
    print("it's not a number")
  end
end

See also Edit

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.