LUA
LUA知识点总结
Lingo_work
这个作者很懒,什么都没留下…
展开
-
LUA-----自带库;垃圾回收
文章目录自带库垃圾回收 自带库 print("*******自带库*********") print("*******时间*********") --系统时间 print(os.time()) --自己传入参数 得到时间 print(os.time({year=2020,month=12,day=12})) --os.date("*t") local nowTime = os.date("*t") for k,v in pairs(nowTime) do print(k,v) end print(now原创 2021-02-20 05:34:50 · 146 阅读 · 1 评论 -
LUA--------面向对象
print("*******面向对象********") print("*******封装********") --本质上都是通过表来实现的 Object={} Object.id = 1 function Object:Test() -- body print(self.id) end --冒号 会自动调用这个函数的对象 作为第一个函数传入的写法 function Object:new( ... ) -- body --self 代表我们默认传入的第一个参数 --对象就是变量 返回一个原创 2021-02-19 21:52:56 · 68 阅读 · 0 评论 -
LUA-----元表
print("*******元表********") print("*******元表概念********") --任何表变量都可以作为另一个表变量的元素 --任何表变量都可以有自己的元表 --当我们子表中进行一些特定操作时,会执行元表中的内容 print("*******设置元表********") meta={} myTable={} --设置元表函数 (子表,元表) setmetatable(myTable,meta) print("*******特定操作********") print("*原创 2021-02-19 20:14:39 · 68 阅读 · 0 评论 -
LUA------多脚本执行;特殊用法;协程
文章目录多脚本执行特殊用法协程 多脚本执行 print("Test测试") testA="123" local testLocalA="456" print("*******多脚本执行********") print("*******全局变量和本地变量********") for i=1,2 do c="小明" end print(c) --局部变量关键字 local for i=1,2 do local d="小王" print("循环中的d") end print(d) print原创 2021-02-19 16:41:45 · 141 阅读 · 0 评论 -
LUA-------表
文章目录数组ipairs和pairs遍历字典、类、结构体和表的公共方法 数组 print("********复杂数据类型 table******") print("********数组******") a={1,2,3,4,"1231",true,nil} --LUA中索引从1开始!!!!!!!!!! print(a[1]) --获取长度的关键字:# --碰到中间有nil,长度就断了 print(#a) print("********数组的遍历******") for i=1,#a do print(原创 2021-02-19 00:41:30 · 97 阅读 · 0 评论 -
LUA----简单数据类型
文章目录注释变量字符串运算符条件分支语句循环函数 注释 --单行注释 --lua语句可以省略分号 print("你好世界") print("你好世界") --[[ 多行 注释 ]] 变量 print("*******变量*********") --nil number string boolean --lua中所有的变量不需要指定类型,会自动判断 --type返回值是string --nil 空 a=nil print(a) print(type(a)) --number 所有的数值都是number原创 2021-02-18 15:34:43 · 89 阅读 · 0 评论 -
AB包
AB包加载 同步 using System.Collections; using System.Collections.Generic; using UnityEngine; public class ABtest : MonoBehaviour { // Start is called before the first frame update void Start() { //加载AB包 AssetBundle ab = AssetBundle.原创 2021-02-16 19:03:10 · 404 阅读 · 0 评论