LMLPHP后院

Lua 数据类型

Lua 语言中有如下基本数据类型:

  • nil:空值
  • boolean:true 或 false
  • number:浮点数
  • string:字符串
  • function:函数
  • userdata:C 数据结构
  • thread:独立线路
  • table:关联数组

使用 type 函数获取值的类型:

type("lmlphp")

变量直接赋值即可初始化。

对于一大块字符串的初始化,可以使用双方括号:

longStr = [[
this is a long long str
...
]]

table 的定义

tbl = {}
tbl = {"apple","banana","orange"}

function 的定义

function func(param)

end
2024-04-20 16:03:46 1713600226 0.009414