lua type 获取 类型

lua中的类型作一小记

print(type("Hello world")) --> string print(type(10.4*3)) --> number print(type(print)) --> function print(type(type)) --> function print(type(true)) --> boolean print(type(nil)) --> nil print(type(type(X))) --> string

注意:
print(type(type(X)))        --> string

是string类型 因此在通过类型比较时 应该这样比较

type(1) == 'number' 

结果是 true

原文地址:https://www.cnblogs.com/unityzc/p/8184105.html