随笔分类 -  Lua

摘要:Lua程序设计语言 是一个简洁、轻量、可扩展的脚本语言。Lua读作/'lua/(撸啊),是葡萄牙语中“Luna”(月亮)的意思。 官网:https://www.lua.org/about.html 我个人喜欢官网的读法。 维基百科读:/ˈluːə/https://en.wikipedia.org/w 阅读全文
posted @ 2022-11-08 17:00 船长博客 阅读(1243) 评论(0) 推荐(0) 编辑
摘要:1. 日期转秒: datestr="2021-12-30 03:27" pattern="(%d+)-(%d+)-(%d+) (%d+):(%d+)" year,month,day,hour,min=datestr:match(pattern) print(day, month, year, hou 阅读全文
posted @ 2021-12-30 20:28 船长博客 阅读(2136) 评论(0) 推荐(0) 编辑
摘要:--test.lua if arg[1] == '1' then print("Hello World!") elseif arg[1] == '2' then print("Hi, Captain!") else print("Hi, Tom") end root@test# lua test.l 阅读全文
posted @ 2021-12-24 10:18 船长博客 阅读(423) 评论(0) 推荐(0) 编辑
摘要:dkjson下载 local dkjson = require "dkjson" local data = {} data.name= "test" data.array = {} print(dkjson.encode(data)) 输出: {"name":"test","array":[]} 阅读全文
posted @ 2021-11-10 20:11 船长博客 阅读(459) 评论(1) 推荐(0) 编辑
摘要:a = byte2bin(127) print(a) 输出: 01111111 原文 : http://love2d.org/forums/viewtopic.php?f=4&t=84988&start=10 阅读全文
posted @ 2019-10-25 17:58 船长博客 阅读(5029) 评论(0) 推荐(0) 编辑
摘要:Passing Tables to Lua Functions A use case that happens often is the passing of tables to and from Lua functions. How is that handled? There are a few idioms you see over and over again to make it ha... 阅读全文
posted @ 2019-04-01 10:41 船长博客 阅读(295) 评论(0) 推荐(0) 编辑
摘要:#lua test.lua 2 5 arg[0]= test.lua arg[1]= 2 arg[2]= 5 if arg[1] and arg[1] == "2" then print("arg[1]=2") end 阅读全文
posted @ 2018-10-18 16:43 船长博客 阅读(5680) 评论(0) 推荐(0) 编辑
摘要:参考: https://my.oschina.net/u/223340/blog/382895 http://lua-users.org/wiki/SaveTableToFile https://stackoverflow.com/questions/36834786/how-to-save-a-t 阅读全文
posted @ 2018-01-31 09:56 船长博客 阅读(1707) 评论(0) 推荐(1) 编辑

永远相信美好的事情即将发生!
点击右上角即可分享
微信分享提示