lua常用方法收集
1. xlua之将c#集合转换成table
-- 将c#的list转换成table
local function ConvertCSListToTable(list)
local t = {};
for i = , list.Count - do
table.insert(t, list[i]);
end
return t;
end -- 将c#的数组转换成table
local function ConvertCSArrayToTable(array)
local t = {};
for i = , array.Length - do
table.insert(t, array[i]);
end
return t;
end -- 将c#的字典转换成table
local function ConvertCSDicToTable(dic)
local t = {};
local etor = dic:GetEnumerator(); while (etor:MoveNext())
do
local current = etor.Current;
local k = current.Key;
local v = current.Value;
table.insert(t, {k, v});
end return t;
end
2. 分割字符串
-- 分割字符串
function this.Split(input, delimiter)
input = tostring(input);
delimiter = tostring(delimiter); if (delimiter == "") then
return false;
end local pos,arr = , {};
for st,sp in function() return string.find(input, delimiter, pos, true) end do
table.insert(arr, string.sub(input, pos, st - ));
pos = sp + ;
end
table.insert(arr, string.sub(input, pos));
return arr;
end
3. 判断 unity3d 中 GameObject 是否为 null
详见:https://blog.csdn.net/qq_34907362/article/details/80482493
function IsNil(uobj)
return uobj == nil or uobj:Equals(nil)
end
4. xlua之与c#枚举器的关系
|
小鱼人(692540236) 13:20:32
xlua中我如果想跟c#中一样去启动新协程,等新协程结束再执行后面的逻辑,怎么弄啊?
|
|
Home_to_the_mold(383894728) 13:45:33
-- HotFix.UIRankMainTest.lua
-- 模拟Lua侧的异步回调 local function lua_async_test(seconds, coroutine_break) print('lua_async_test '..seconds..' seconds!') -- TODO:这里还是用Unity的协程相关API模拟异步,有需要的话再考虑在Lua侧实现一个独立的协程系统 yield_return(CS.UnityEngine.WaitForSeconds(seconds)) coroutine_break(true, seconds) end -- lua侧新建协程:本质上是在Lua侧建立协程,然后用异步回调驱动, -- 协程热更示例 -- cs侧协程热更 |
转载请注明出处:http://www.cnblogs.com/jietian331/p/8118230.html
lua常用方法收集的更多相关文章
- Lua 错误 收集
不存在的变量或者变量没有定义,提示错误 // :: [error] #: * lua entry thread aborted: runtime error: /opt/openresty/nginx ...
- lua错误收集
这里放一些我遇到的lua错误,希望大家分享一些错误给我,统一放在这里. 1.lua表的引用传值 上面的代码运行后会发现t2[2],t2[3]表里的内容也被删除了,实际上它们 与t2[1]表里的内容都是 ...
- js常用方法收集
JS获取地址栏制定参数值: //获取URL参数的值 function getUrlParam(name){ var reg = new RegExp("(^|&)"+ na ...
- lua . 命令收集
io.popen()## 原型:io.popen ([prog [, mode]]) 解释:在额外的进程中启动程序prog,并返回用于prog的文件句柄.通俗的来说就是使用这个函数可以调用一个命令(程 ...
- php apache 和mysql查看版本常用方法收集
php: 1.命令行查询,下图是因为添加php进系统环境变量了 2.预定义常量PHP_VERSION查询 3.phpversion()函数查询 4.phpinfo()查询 apache: mysql: ...
- Lua语言中文手册 转载自网络
Programming in LuaCopyright ® 2005, Translation Team, www.luachina.net Programming in LuaProgramming ...
- Javascript常用方法函数收集(二)
Javascript常用方法函数收集(二) 31.判断是否Touch屏幕 function isTouchScreen(){ return (('ontouchstart' in window) || ...
- 使用nginx lua实现网站统计中的数据收集
导读网站数据统计分析工具是各网站站长和运营人员经常使用的一种工具,常用的有 谷歌分析.百度统计和腾讯分析等等.所有这些统计分析工具的第一步都是网站访问数据的收集.目前主流的数据收集方式基本都是基于ja ...
- ios开发总结:Utils常用方法等收集,添加扩展类,工具类方法,拥有很多方便快捷功能(不断更新中。。。)
BOBUtils 工具大全 本人github开源和收集功能地址:https://github.com/niexiaobo [对ios新手或者工作一年以内开发人员很有用处] 常用方法等收集.添加扩展类. ...
随机推荐
- Vue:在vue-cli中使用Bootstrap
一.安装jQuery Bootstrap需要依赖jQuery,所以引用Bootstrap之前要先引用jQuery,使用下面的命令引用jQuery: npm install jquery --save ...
- [微信小程序] 通过快速启动demo分析小程序入门关键点
(1)小程序基础结构 下图是在开发者工具通过快速启动模式创建的小程序的目录结构 可以看到,小程序中主要包含有4中类型不同的文件 .json 后缀的 JSON 配置文件 .wxml 后缀的 WXML 模 ...
- Ubuntu环境使用apt命令下载管理包的优势
操作系统:Ubuntu 18.04 LTS 一.概述 之前在Ubuntu下我一直坚持将软件下载包下载到指定文件夹下进行解压安装的习惯,在部门同事的建议下,我开始使用apt命令下载管理包. 由于网上已经 ...
- JS中常用的Math方法
1.min()和max()方法 Math.min()用于确定一组数值中的最小值.Math.max()用于确定一组数值中的最大值. alert(Math.min(2,4,3,6,3,8,0,1,3)); ...
- Thread类的join()方法
public class Demo { /** * Thread类的join()方法 * -------------------------------- * 1)join() * 2)join(lo ...
- 理解面向过程(OPP)、面向对象(OOP)、面向切面(AOP)
概念 面向过程编程OPP:Procedure Oriented Programming,是一种以事物为中心的编程思想.主要关注“怎么做”,即完成任务的具体细节. 面向对象编程OOP:Object Or ...
- Microsoft office 2019 正式版镜像下载
http://www.xitongtiandi.net/soft_yy/4373.htmlMicrosoft office 2019 正式版镜像下载 http://www.xitongtiandi.n ...
- PDO连接数据库-Xmodel
<?php/* * Copyright (c) 2018, 北京博习园教育科技有限公司 * All rights reserved. * * 文件名称: xmodel.php * 摘 要: 模型 ...
- nodejs(二)浏览器与服务器连接初探
- SQL语句精简版
select US.QQ,US.tel,US.username,SC.EnglishScore,SC.MathScorefrom Userinfor US right join Score SC on ...