摘要: using System.IO; using UnityEngine; using XLua; namespace DSFramework { /// <summary> /// Lua管理器 /// 保证解析器的唯一性 /// </summary> public class DSLuaMgr : 阅读全文
posted @ 2020-10-28 14:43 UnitySir 阅读(211) 评论(0) 推荐(0)
摘要: using System.Collections; using System.Collections.Generic; using UnityEngine; using XLua; public class Lesson9_CallLuaTable : MonoBehaviour { void St 阅读全文
posted @ 2020-10-28 14:41 UnitySir 阅读(893) 评论(0) 推荐(0)
摘要: using DSFramework; using UnityEngine; using UnityEngine.Events; using XLua; //接口不允许有成员变量 //可以使用属性来接收 [CSharpCallLua] public interface ILuaCallInterfac 阅读全文
posted @ 2020-10-28 14:39 UnitySir 阅读(290) 评论(0) 推荐(0)
摘要: using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Events; using XLua; public class CallLuaClass { //在这个 阅读全文
posted @ 2020-10-28 14:37 UnitySir 阅读(254) 评论(0) 推荐(0)
摘要: using System.Collections; using System.Collections.Generic; using UnityEngine; public class Lesson6_CallListDic : MonoBehaviour { void Start() { LuaMg 阅读全文
posted @ 2020-10-28 14:35 UnitySir 阅读(402) 评论(0) 推荐(0)
摘要: using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Events; using XLua; //无参无返回值的委托 public 阅读全文
posted @ 2020-10-28 14:33 UnitySir 阅读(466) 评论(0) 推荐(0)
摘要: using System.Collections; using System.Collections.Generic; using UnityEngine; public class Lesson4_CallVariable : MonoBehaviour { void Start() { LuaM 阅读全文
posted @ 2020-10-28 14:31 UnitySir 阅读(211) 评论(0) 推荐(0)
摘要: using System.Collections; using System.Collections.Generic; using DSFramework; using UnityEngine; public class Lession3_LuaMgr : MonoBehaviour { void 阅读全文
posted @ 2020-10-28 14:28 UnitySir 阅读(117) 评论(0) 推荐(0)
摘要: using System.Collections; using System.Collections.Generic; using System.IO; using UnityEngine; using XLua; public class Lesson2_Loader : MonoBehaviou 阅读全文
posted @ 2020-10-28 14:26 UnitySir 阅读(273) 评论(0) 推荐(0)
摘要: print("**********垃圾回收************") test = {id = 1, name = "123123"} --垃圾回收关键字 --collectgarbage --获取当前lua占用内存数 K字节 用返回值*1024 就可以得到具体的内存占用字节数 print(col 阅读全文
posted @ 2020-10-28 14:15 UnitySir 阅读(196) 评论(0) 推荐(0)
摘要: print("**********自带库************") --string --table print("**********时间************") --系统时间 print(os.time()) --自己传入参数 得到时间 print(os.time({year = 2014 阅读全文
posted @ 2020-10-28 14:14 UnitySir 阅读(160) 评论(0) 推荐(0)
摘要: --面向对象实现 --万物之父 所有对象的基类 Object --封装 Object = {} --实例化方法 function Object:new() local obj = {} --给空对象设置元表 以及 __index self.__index = self setmetatable(ob 阅读全文
posted @ 2020-10-28 14:13 UnitySir 阅读(198) 评论(0) 推荐(0)
摘要: print("**********面向对象************") print("**********封装************") --面向对象 类 其实都是基于 table来实现 --元表相关的知识点 Object = {} Object.id = 1 function Object:Te 阅读全文
posted @ 2020-10-28 14:11 UnitySir 阅读(147) 评论(0) 推荐(0)
摘要: print("**********元表************") print("**********元表概念************") --任何表变量都可以作为另一个表变量的元表 --任何表变量都可以有自己的元表(爸爸) --当我们子表中进行一些特定操作时 --会执行元表中的内容 print(" 阅读全文
posted @ 2020-10-28 14:08 UnitySir 阅读(126) 评论(0) 推荐(0)
摘要: print("**********协同程序************") print("**********协程的创建************") --常用方式 --coroutine.create() fun = function() print(123) end co = coroutine.cr 阅读全文
posted @ 2020-10-28 14:07 UnitySir 阅读(121) 评论(0) 推荐(0)
摘要: print("**********特殊用法************") print("**********多变量赋值************") local a,b,c = 1,2,"123" print(a) print(b) print(c) --多变量赋值 如果后面的值不够 会自动补空 a,b 阅读全文
posted @ 2020-10-28 14:05 UnitySir 阅读(130) 评论(0) 推荐(0)
摘要: print("**********多脚本执行************") print("**********全局变量和本地变量************") --全局变量 a = 1 b = "123" for i = 1,2 do c = "U" end print(c) --本地(局部)变量的关键 阅读全文
posted @ 2020-10-28 14:04 UnitySir 阅读(149) 评论(0) 推荐(0)
摘要: print("**********复杂数据类型——表2************") print("**********字典************") print("**********字典的申明************") --字典是由键值对构成 a = {["name"] = "US", ["a 阅读全文
posted @ 2020-10-28 14:00 UnitySir 阅读(116) 评论(0) 推荐(0)
摘要: print("**********迭代器遍历************") --迭代器遍历 主要是用来遍历表的 --#得到长度 其实并不准确 一般不要用#来遍历表 a = {[0] = 1, 2, [-1]=3, 4, 5, [5] = 6} print("**********ipairs迭代器遍历* 阅读全文
posted @ 2020-10-28 13:57 UnitySir 阅读(124) 评论(0) 推荐(0)
摘要: print("**********复杂数据类型 talbe************") --所有的复杂类型都是table(表) print("**********数组************") a = {1,2,nil,3,"1231",true,nil} --lua中 索引从1开始 print( 阅读全文
posted @ 2020-10-28 13:56 UnitySir 阅读(108) 评论(0) 推荐(0)
摘要: print("**********函数************") --function 函数名() --end --a = function() --end print("**********无参数无返回值************") function F1() print("F1函数") end 阅读全文
posted @ 2020-10-28 13:54 UnitySir 阅读(109) 评论(0) 推荐(0)
摘要: print("**********循环语句************") print("**********while语句************") num = 0 --while 条件 do ..... end while num < 5 do print(num) num = num + 1 e 阅读全文
posted @ 2020-10-28 13:52 UnitySir 阅读(188) 评论(0) 推荐(0)
摘要: print("**********条件分支语句************") a = 9 --if 条件 then.....end --单分支 if a > 5 then print("123") end --双分支 -- if 条件 then.....else.....end if a < 5 th 阅读全文
posted @ 2020-10-28 13:51 UnitySir 阅读(164) 评论(0) 推荐(0)
摘要: print("**********运算符************") print("**********算数运算符************") -- + - * / % ^ -- 没有自增自减 ++ -- -- 没有复合运算符 += -= /= *= %= --字符串 可以进行 算数运算符操作 会自 阅读全文
posted @ 2020-10-28 13:49 UnitySir 阅读(127) 评论(0) 推荐(0)
摘要: print("**********字符串************") str = "双引号字符串" str2 = '单引号字符串' --获取字符串的长度 print("**********字符串长度************") s = "aBcdEfG字符串" --一个汉字占3个长度 --英文字符 阅读全文
posted @ 2020-10-28 13:47 UnitySir 阅读(206) 评论(0) 推荐(0)