摘要: optional_function_scope function function_name( argument1, argument2, argument3..., argumentn) function_body return result_params_comma_separated end 阅读全文
posted @ 2020-07-12 22:02 流星曳尾 阅读(179) 评论(0) 推荐(0) 编辑
摘要: if(布尔表达式) then --[ 在布尔表达式为 true 时执行的语句 --] end if(布尔表达式) then --[ 布尔表达式为 true 时执行该语句块 --] else --[ 布尔表达式为 false 时执行该语句块 --] end if( 布尔表达式 1) then --[ 阅读全文
posted @ 2020-07-12 17:11 流星曳尾 阅读(123) 评论(0) 推荐(0) 编辑
摘要: goto Label :: Label ::用goto实现continue的功能for i=1, 3 do if i <= 2 then print(i, "yes continue") goto continue end print(i, " no continue") ::continue:: 阅读全文
posted @ 2020-07-12 16:59 流星曳尾 阅读(923) 评论(0) 推荐(0) 编辑
摘要: while循环 while(condition) do statements end for循环 for var=exp1,exp2,exp3 do statements end 注:var 从 exp1 变化到 exp2,每次变化以 exp3 为步长递增 var,并执行一次 "执行体"。exp3 阅读全文
posted @ 2020-07-12 16:12 流星曳尾 阅读(199) 评论(0) 推荐(0) 编辑
摘要: a, b = 10, 2*x <--> a=10; b=2*x多值赋值经常用来交换变量,或将函数调用返回给变量: x, y = y, x -- swap 'x' for 'y' a[i], a[j] = a[j], a[i] -- swap 'a[i]' for 'a[j]' a, b = f() 阅读全文
posted @ 2020-07-12 15:44 流星曳尾 阅读(973) 评论(0) 推荐(0) 编辑