Ulua_toLua_基本案例(六)_LuaCoroutine2
Ulua_toLua_基本案例(六)_LuaCoroutine2
using UnityEngine;
using System.Collections;
using LuaInterface; public class TestCoroutine2 : MonoBehaviour
{
LuaState luaState = null; string script =
@"
function CoExample()
WaitForSeconds(2)
print('WaitForSeconds end time: '.. UnityEngine.Time.time)
WaitForFixedUpdate()
print('WaitForFixedUpdate end frameCount: '..UnityEngine.Time.frameCount)
WaitForEndOfFrame()
print('WaitForEndOfFrame end frameCount: '..UnityEngine.Time.frameCount)
Yield(null)
print('yield null end frameCount: '..UnityEngine.Time.frameCount)
Yield(0)
print('yield(0) end frameCime: '..UnityEngine.Time.frameCount)
local www = UnityEngine.WWW('http://www.baidu.com')
Yield(www)
print('yield(www) end time: '.. UnityEngine.Time.time)
local s = tolua.tolstring(www.bytes)
print(s:sub(1, 128))
print('coroutine over')
end function TestCo()
print('TestCo')
local co = coroutine.create(CoExample) local flag, msg = coroutine.resume(co) if not flag then
error(msg)
end
end
"; void Awake ()
{
luaState = new LuaState();
luaState.Start();
LuaBinder.Bind(luaState);
LuaCoroutine.Register(luaState, this); luaState.DoString(script);
LuaFunction func = luaState.GetFunction("TestCo");
func.Call();
func.Dispose();
} void OnDestroy()
{
luaState.Dispose();
luaState = null;
}
}
Ulua_toLua_基本案例(六)_LuaCoroutine2的更多相关文章
- WPF案例 (六) 动态切换UI布局
原文:WPF案例 (六) 动态切换UI布局 这个Wpf示例对同一个界面支持以ListView或者CardView的布局方式呈现界面,使用控件ItemsControl绑定数据源,使用DataTempla ...
- Ulua_toLua_基本案例(八)_LuaAccessingArray
Ulua_toLua_基本案例(八)_LuaAccessingArray using UnityEngine; using LuaInterface; public class AccessingAr ...
- Ulua_toLua_基本案例(一)
Ulua_toLua_基本案例 在Untiy中用Lua.必需要LuaInterface.LuaInterface的介绍请看:点击打开链接 能够先光写Lua,生成.lua的纯文件.再Unity中通过,l ...
- awk处理之案例六:awk根据条件插入文本
编译环境 本系列文章所提供的算法均在以下环境下编译通过. [脚本编译环境]Federa 8,linux 2.6.35.6-45.fc14.i686 [处理器] Intel(R) Core(TM)2 Q ...
- JavaScript案例六:简单省市联动(NBA版)
JavaScript实现简单省市(NBA版)联动 <!DOCTYPE html> <html> <head> <title>JavaScript实现简单 ...
- 进阶:案例六: Context Menu(静态 与 动态)
实现: 1.add: 2.delete 3.add2 实现步骤: 1.新建属性display_text 2.创建layout 3.代码部分: add事件: METHOD onactionadd . D ...
- JS案例六_2:省市级联动
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
- JS案例六_1:添加城市
使用的相关知识点:对子节点的添加:document.appendClild() 文本节点的创建:document.createTextNode() 元素节点的创建:document.createEle ...
- Ulua_toLua_基本案例(二)_ScriptsFromFile
在Untiy中用Lua.必需要LuaInterface. LuaInterface的介绍请看:点击打开链接 能够先光写Lua,生成.lua的纯文件. 再Unity中通过,luaState.DoFile ...
随机推荐
- 实战c++中的string系列--string与char*、const char *的转换(data() or c_str())
在project中,我们也有非常多时候用到string与char*之间的转换,这里有个一我们之前提到的函数 c_str(),看看这个原型: const char *c_str(); c_str()函数 ...
- mysql show global variables字符超1024会被截断
show variables 会存在数据被截断的问题: select 全局变量没有问题 官网解释:https://dev.mysql.com/doc/refman/5.6/en/variables-t ...
- vim for python
set encoding=utf8 set paste 编辑模式下的 复制粘贴 set expandtab 貌似是一个 tab 替换成4个空格, 而且当你使用 backspace(删除键), 会自 ...
- 构建Java并发模型框架
Java的多线程特性为构建高性能的应用提供了极大的方便,但是也带来了不少的麻烦.线程间同步.数据一致性等烦琐的问题需要细心的考虑,一不小心就会出现一些微妙的,难以调试的错误.另外,应用逻辑和线程逻辑纠 ...
- 解决java.lang.IllegalStateException: The application’s PagerAdapter changed the adapter’s content
A界面中有viewpager的动态加载,从界面A跳到界面B,再finish掉B返回A时报出此异常. java.lang.IllegalStateException: The application's ...
- Qt之QLocalServer
简述 QLocalServer提供了一个基于本地socket的server. QLocalServer可以接受来自本地socket的连接.通过调用listen(),让server监听来自特定key的连 ...
- 更改虚拟机UUID
如何更改虚拟机UUID?以下方法适用于:Parallels Desktop 10 for MacParallels Desktop 9 for MacParallels Desktop 8 for M ...
- 如何安装Node.js环境
一.在Windows系统下安装Node.js环境 1. 下载地址:官网http://nodejs.org/ 2. 安装nodejs,根据自己情况,安装路径 D:\Program Files\nod ...
- ADB 设置远程调试
Version:0.9 StartHTML:-1 EndHTML:-1 StartFragment:00000099 EndFragment:00016657 相信很多人在android 开发调试的时 ...
- Mac和Linux下pip更换源
cd ~mkdir .pip vim .pip/pip.conf 在pip.conf中写入 [global]timeout = 6000index-url = https://pypi.tuna.ts ...