All Products
Search
Document Center

CDN:Debug function

Last Updated:Apr 01, 2026

Returns the type of a variable as a string. Use type() in Alibaba Cloud CDN EdgeScript to inspect variable types at runtime or write type-conditional logic.

type

Returns the type of its only argument as a string.

Syntax

type(s)

Parameter

ParameterTypeDescription
sAnyThe variable to inspect. Accepts exactly one argument.

Return value

A string indicating the type of s. The following table lists all possible return values.

Return valueType
"string"String
"number"Number
"table"Table (array or map)
The return value is always of type string, regardless of the type of s.

Example

m = type('100')       -- string literal: returns "string"
n = type(100)         -- number literal: returns "number"
t = type(['a', 'b'])  -- table literal:  returns "table"
say(concat('type(m)=', m))
say(concat('type(n)=', n))
say(concat('type(t)=', t))

Output:

type(m)=string
type(n)=number
type(t)=table