摘要:
print("**********协同程序************") print("**********协程的创建************") --常用方式 --coroutine.create() fun = function() print(123) end co = coroutine.cr 阅读全文
摘要:
print("**********特殊用法************") print("**********多变量赋值************") local a,b,c = 1,2,"123" print(a) print(b) print(c) --多变量赋值 如果后面的值不够 会自动补空 a,b 阅读全文
摘要:
print("**********多脚本执行************") print("**********全局变量和本地变量************") --全局变量 a = 1 b = "123" for i = 1,2 do c = "U" end print(c) --本地(局部)变量的关键 阅读全文
摘要:
print("**********复杂数据类型——表2************") print("**********字典************") print("**********字典的申明************") --字典是由键值对构成 a = {["name"] = "US", ["a 阅读全文
摘要:
print("**********迭代器遍历************") --迭代器遍历 主要是用来遍历表的 --#得到长度 其实并不准确 一般不要用#来遍历表 a = {[0] = 1, 2, [-1]=3, 4, 5, [5] = 6} print("**********ipairs迭代器遍历* 阅读全文
摘要:
print("**********复杂数据类型 talbe************") --所有的复杂类型都是table(表) print("**********数组************") a = {1,2,nil,3,"1231",true,nil} --lua中 索引从1开始 print( 阅读全文
摘要:
print("**********函数************") --function 函数名() --end --a = function() --end print("**********无参数无返回值************") function F1() print("F1函数") end 阅读全文
摘要:
print("**********循环语句************") print("**********while语句************") num = 0 --while 条件 do ..... end while num < 5 do print(num) num = num + 1 e 阅读全文
摘要:
print("**********条件分支语句************") a = 9 --if 条件 then.....end --单分支 if a > 5 then print("123") end --双分支 -- if 条件 then.....else.....end if a < 5 th 阅读全文
摘要:
print("**********运算符************") print("**********算数运算符************") -- + - * / % ^ -- 没有自增自减 ++ -- -- 没有复合运算符 += -= /= *= %= --字符串 可以进行 算数运算符操作 会自 阅读全文