上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 36 下一页
摘要: --module.lua module = {} module.num = 13 module.f1 = function (a,b) return a + bend --test.lua require('module') print(module.f1(5,6)) --11 阅读全文
posted @ 2020-09-29 15:09 流星曳尾 阅读(278) 评论(0) 推荐(0) 编辑
摘要: tab = {'sss',123,'sswg'} print(table.concat(tab,',')) --sss,123,sswg 阅读全文
posted @ 2020-09-29 14:57 流星曳尾 阅读(436) 评论(0) 推荐(0) 编辑
摘要: a = {key = 'ssss',1,2,3} for i=1,5 do print(a[i])end --[[123nilnil--]] print() for i,v in ipairs(a) do print(v)end --[[123--]] print() for k,v in pair 阅读全文
posted @ 2020-09-29 14:34 流星曳尾 阅读(107) 评论(0) 推荐(0) 编辑
摘要: print('aaa\'sss\'bbb') --aaa'sss'bbb 阅读全文
posted @ 2020-09-29 14:13 流星曳尾 阅读(1011) 评论(0) 推荐(0) 编辑
摘要: a = 3 if not a == 4 then print('1')else print('2')end --2 阅读全文
posted @ 2020-09-29 13:58 流星曳尾 阅读(999) 评论(0) 推荐(0) 编辑
摘要: rt 阅读全文
posted @ 2020-09-29 13:51 流星曳尾 阅读(7532) 评论(0) 推荐(0) 编辑
摘要: function sum(...) res = 0 tab = {...} for i,v in ipairs(tab) do res = res + v end return resend print(sum(2,65,3))--70 阅读全文
posted @ 2020-09-29 13:41 流星曳尾 阅读(1079) 评论(0) 推荐(0) 编辑
摘要: rt 阅读全文
posted @ 2020-09-29 13:28 流星曳尾 阅读(763) 评论(0) 推荐(0) 编辑
摘要: ::label:: --与goto一起使用,可以goto label 阅读全文
posted @ 2020-09-29 13:21 流星曳尾 阅读(364) 评论(0) 推荐(0) 编辑
摘要: 迭代ipairs时只迭代list部分,且碰到nil会停止 迭代pairs时先迭代list部分后迭代dic部分。 a = {key = 3434,"one", nil ,"two", "three"}for i, v in ipairs(a) do print(i, v)end --[[1 one-- 阅读全文
posted @ 2020-09-29 12:05 流星曳尾 阅读(202) 评论(0) 推荐(0) 编辑
上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 36 下一页