lua practice
1 Lua 环境安装。[https://www.runoob.com/lua/lua-environment.html (2024](https://www.runoob.com/lua/lua-environment.html (2024)年5月12日)
2 Lua 基本语法。[https://www.runoob.com/lua/lua-basic-syntax.html (2024](https://www.runoob.com/lua/lua-basic-syntax.html (2024)年5月12日)
3 Create repo lua. Done. (2024年5月12日)
4 Print hello world in terminal. Done. (2024年5月12日)
5 Print hello world in script. Done. (2024年5月12日)
6 Lua 数据类型。https://www.runoob.com/lua/lua-data-types.html (2024年5月12日)
7 Lua 变量。[https://www.runoob.com/lua/lua-variables.html (2024](https://www.runoob.com/lua/lua-variables.html (2024)年5月12日)
8 Lua 中的变量全是全局变量,哪怕是语句块或是函数里,除非用 local 显式声明为局部变量。
9 赋值语句。
10 Lua 循环。[https://www.runoob.com/lua/lua-loops.html (2024](https://www.runoob.com/lua/lua-loops.html (2024)年5月12日)
11 Lua 流程控制。https://www.runoob.com/lua/lua-decision-making.html 就是判断语句。Then 不换行更美观。
12 Lua 函数。https://www.runoob.com/lua/lua-functions.html多返回值。可变参数。
Lua 运算符。https://www.runoob.com/lua/lua-miscellaneous-operator.html
^ 乘幂 A^2 输出结果 100
~= 不等于,检测两个值是否相等,不相等返回 true,否则返回 false (A ~= B) 为 true。
and or not.
.. 连接两个字符串
# 一元运算符,返回字符串或表的长度。
Lua 字符串。https://www.runoob.com/lua/lua-strings.html 单引号、双引号、方括号。
在 Lua 中,要计算字符串的长度(即字符串中字符的个数),你可以使用 string.len函数或 utf8.len 函数,包含中文的一般用 utf8.len,string.len 函数用于计算只包含 ASCII 字符串的长度。
- %d, %i - 接受一个数字并将其转化为有符号的整数格式
- %f - 接受一个数字并将其转化为浮点数格式
Lua 数组。https://www.runoob.com/lua/lua-arrays.html
local myArray = {10, 20, 30, 40, 50}
for i = 1, #myArray do
Lua 迭代器。https://www.runoob.com/lua/lua-iterators.html
迭代器(iterator)是一种对象,它能够用来遍历标准模板库容器中的部分或全部元素,每个迭代器对象代表容器中的确定的地址。
Lua table(表)。https://www.runoob.com/lua/lua-tables.html
Lua 文件 I/O。https://www.runoob.com/lua/lua-file-io.html