摘要: isok = false;--逻辑运算符--规定nil为false--print( ms and isok)--print(4 and 5)--print (false and 13)--print(false and 13)--a or b a为true 返回a 否则返回b--print (4 a 阅读全文
posted @ 2016-10-27 19:11 无畏先锋 阅读(2190) 评论(0) 推荐(0) 编辑
摘要: --单行注释--[[多行注释]]--变量声明的时候 不需要声明类型str = "Hello World"--多个变量name,age ="LanOu",4,5,10print(str)print(name,age,ad) 阅读全文
posted @ 2016-10-27 19:09 无畏先锋 阅读(1497) 评论(0) 推荐(0) 编辑
摘要: --冒泡排序nums = {3,11,2,123,1}len = #numsfor i = 1,len-1 do for j = 1,len-i do if nums[j]>nums[j+1] then temp= nums[j+1] nums[j+1]= nums[j] nums[j]= temp 阅读全文
posted @ 2016-10-27 19:07 无畏先锋 阅读(2177) 评论(0) 推荐(0) 编辑
摘要: --男人类man = {name = "man",age=123}--继承空间man.__index=man--儿童类child= {}--继承setmetatable(child,man)print(child.age)yong= {}setmetatable(yong,man)child.age 阅读全文
posted @ 2016-10-27 19:05 无畏先锋 阅读(163) 评论(0) 推荐(0) 编辑
摘要: --使用table封装面向对象beauty={name = " "}--封装对象方法function beauty.init(self, name)print("十八年前的一天王小丫出生")self.name= nameend--一般使用下面这种形式function beauty:init( nam 阅读全文
posted @ 2016-10-27 19:03 无畏先锋 阅读(122) 评论(0) 推荐(0) 编辑
摘要: function SayHey(mag) for i = 1 , 3 doprint(mag)coroutine.yield()end end --创建携程(协同) coFunc= coroutine.create(SayHey)--查看携程状态print(coroutine.status(coFu 阅读全文
posted @ 2016-10-27 19:01 无畏先锋 阅读(1122) 评论(0) 推荐(0) 编辑
摘要: --require("6-Coroutine")--仅加载一次,并不执行--dofile("6-Coroutine.lua") --加载并执行--SayHey("kkkk")x=10 --默认是全局变量 show= function()local x = 1for i = 1 ,5 dox = x+ 阅读全文
posted @ 2016-10-27 19:00 无畏先锋 阅读(1947) 评论(0) 推荐(0) 编辑
摘要: http://www.itnose.net/detail/6090246.html 阅读全文
posted @ 2016-10-26 21:41 无畏先锋 阅读(343) 评论(0) 推荐(0) 编辑
摘要: 单一职责:功能分类里是装换:父 子 父 依赖倒置 : 抽象决定具体 设计模式 单例 观察者 迭代器 阅读全文
posted @ 2016-10-26 16:02 无畏先锋 阅读(124) 评论(0) 推荐(0) 编辑
摘要: using UnityEngine;using System.Collections;public class MetrixTools { //全局静态方法,随机获取(返回)一种形状 public static int[,] GetRandomMetrix() { int id = Random.R 阅读全文
posted @ 2016-10-21 21:53 无畏先锋 阅读(561) 评论(0) 推荐(0) 编辑