随笔分类 - Lua
摘要:Lua程序设计语言 是一个简洁、轻量、可扩展的脚本语言。Lua读作/'lua/(撸啊),是葡萄牙语中“Luna”(月亮)的意思。 官网:https://www.lua.org/about.html 我个人喜欢官网的读法。 维基百科读:/ˈluːə/https://en.wikipedia.org/w
阅读全文
摘要: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
阅读全文
摘要:--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
阅读全文
摘要:dkjson下载 local dkjson = require "dkjson" local data = {} data.name= "test" data.array = {} print(dkjson.encode(data)) 输出: {"name":"test","array":[]}
阅读全文
摘要:a = byte2bin(127) print(a) 输出: 01111111 原文 : http://love2d.org/forums/viewtopic.php?f=4&t=84988&start=10
阅读全文
摘要: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...
阅读全文
摘要:#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
阅读全文
摘要:参考: https://my.oschina.net/u/223340/blog/382895 http://lua-users.org/wiki/SaveTableToFile https://stackoverflow.com/questions/36834786/how-to-save-a-t
阅读全文