![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Lua
Chaos_Yeats
我想要的究竟是什么?因为无法做到我全都要?
展开
-
lua table删除元素
lua table删除元素原创 2022-07-12 11:19:02 · 1309 阅读 · 0 评论 -
lua 正则小例子
local function lua_string_split(str, delim) if (type(str) ~= "string") then return {} end local tab = {} string.gsub(str, '[^'..delim..']+', function(sub) table.insert(tab, sub) end) return tabendlocal function trim (s)原创 2021-09-23 13:46:27 · 110 阅读 · 0 评论 -
lua io读写文件的坑
读写lua今天一个小坑却费了我许久时间local file, err = io.open(filename, "a+")一条简单的语句,但是因为我写的是相对路径就报错。err的内容是‘No such file or directory while sending to client;’突然感觉自己好菜,lua能百度解决的问题也真特么的少。写成绝对路径就ok了。...原创 2021-09-13 10:36:12 · 738 阅读 · 0 评论 -
lua table遇见nil,空表的输出
lua table遇见nil,空表的输出local record = {}record[1] = { content = 'c'}record[2] = { content = 'b'}record[3] = { content = 'a'}for _ , r in pairs(record) do print(r.content)endprint('----------')local tmp = {}print(tmp)print('tmp原创 2021-07-12 10:43:11 · 838 阅读 · 0 评论 -
centos7配置openresty 1.19.3.1
# 设置安装的yum源sudo yum install yum-utils -ysudo yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo# 安装Openrestysudo yum install openresty -y# 安装命令行工具 restysudo yum install openresty-resty -y# 查看Opm工具# 命令行工具 opm 在 open原创 2021-01-21 16:10:18 · 1465 阅读 · 0 评论 -
lua学习(三)面向对象
面向对象基础--- 看了许多关于lua实现面向对象的博客还是没明白为什么,因此看看官方教程理解其中例子------ 首先,对象的方法是可以通过表的方法来进行模拟Account = {balance = 0}function Account.withdraw(v) Account.balance = Account.balance - vendAccount.withdraw(100)print(Account.balance)--结果:-- -100--- 然而,全局变量原创 2020-08-19 20:59:09 · 96 阅读 · 0 评论 -
lua学习(二)元表
本文大量参考OpenResty最佳实践以及lua元表详解-->>>>>>>>>>>>>>>> 元表-- 元表是用来定义table或userdata操作方式的表,可以用来实现面向对象-- 元表的设置-- 定义元表local t1 = {1,2,3}local t2 = {2}local mt = {}-- 定义元表mt.__add元方法mt.__add = function(t1,t2)原创 2020-08-18 17:39:56 · 132 阅读 · 0 评论 -
lua学习(一)基础语法
hello.lua------ Generated by EmmyLua(https://github.com/EmmyLua)--- Created by chaosye.--- DateTime: 2020/7/27 17:58------global_val = 5-->>>>>>>>>>>>>>>>>>>>> 表local corp={ 123.原创 2020-08-06 16:39:55 · 248 阅读 · 0 评论 -
IDEA 配置LuaJIT
IDEA 配置LuaJIT下载好LuaJIT,可以下载直接编译好的版本,由于我会使用到OpenResty(包含了LuaJIT),可在其官网直接下载:http://openresty.org/cn/,下载好的内容如下,可以将luajit.exe加入到系统的Path中下载IDEA,然后在plugins中安装上emmylua,这一步很多教程都有3.在IDEA中配置编译器点击Edit Configurations,然后选择luajit.exe此时基本上已经在IDEA中配置好了,还有其它问题原创 2020-07-28 17:49:41 · 594 阅读 · 0 评论