#Lua 的 type 函数
type (v)
说明
获取 v
的类型;返回的结果是字符串:"nil"
,"number"
,"string"
,"boolean"
,"table"
,"function"
,"thread"
,"userdata"
。
参数
v
- 要获取类型的值
返回值
- 返回字符串形式的类型名
#示例
print(type(nil))
print(type(10))
print(type('hello world'))
print(type(true))
print(type({}))
print(type(function() end))
print(type(coroutine.create (function() end)))