Lua
文章目录
pcall
用途: 类似 try catch, 返回 retcode, retvalue 参考:
pairs vs ipairs
_G
用途: 存储全局变量, 以 table 类型存储数据 参考: lua _G 表_程序员黄老师的博客-CSDN博客
table
[] inside table
参考: What is the function of square brackets around table keys in lua? - Stack Ove…
作用: 通过 [] 指定长 key, 类似 python 中 dict 的 ":"。
正确用法:
| |
错误用法:
| |
module 模块
格式: 可以使用 "/" 也可以使用 "." 分割
| |
string 类型
参考: Strings Tutorial
字符串格式:
- ''
- ""
特点
- 允许输入: ', "
- 允许转义
- 允许换行
允许嵌套
[[,]]1 2 3 4 5 6 7 8> = [[one [[two]] one]] -- bad stdin:1: nesting of [[...]] is deprecated near '[' > = [=[one [[two]] one]=] -- ok one [[two]] one > = [===[one [[two]] one]===] -- ok too one [[two]] one > = [=[one [ [==[ one]=] -- ok. nothing special about the inner content. one [ [==[ one
拼接
通过 ".." 符号
文章作者
上次更新 2022-05-25 (7d86273)