Lua笔记(1)

Lua有8种数据类型:nilbooleannumberstringfunctiontableuserdatathread

nil类型只有一个值:nilnil表示没有值,所有未定义的变量值都为nil。请看下面这个例子:

[root@Fedora ~]# lua
Lua 5.3.0  Copyright (C) 1994-2015 Lua.org, PUC-Rio
> a
nil

boolean有两个值:truefalse。在Lua中,只有nilfalse会被当成“假”,包括0在内的其它任何值都被当成“真”:

> not not nil
false
> not not false
false
> not not 0
true

 

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理