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的更多相关文章

  1. WPF案例 (六) 动态切换UI布局

    原文:WPF案例 (六) 动态切换UI布局 这个Wpf示例对同一个界面支持以ListView或者CardView的布局方式呈现界面,使用控件ItemsControl绑定数据源,使用DataTempla ...

  2. Ulua_toLua_基本案例(八)_LuaAccessingArray

    Ulua_toLua_基本案例(八)_LuaAccessingArray using UnityEngine; using LuaInterface; public class AccessingAr ...

  3. Ulua_toLua_基本案例(一)

    Ulua_toLua_基本案例 在Untiy中用Lua.必需要LuaInterface.LuaInterface的介绍请看:点击打开链接 能够先光写Lua,生成.lua的纯文件.再Unity中通过,l ...

  4. awk处理之案例六:awk根据条件插入文本

    编译环境 本系列文章所提供的算法均在以下环境下编译通过. [脚本编译环境]Federa 8,linux 2.6.35.6-45.fc14.i686 [处理器] Intel(R) Core(TM)2 Q ...

  5. JavaScript案例六:简单省市联动(NBA版)

    JavaScript实现简单省市(NBA版)联动 <!DOCTYPE html> <html> <head> <title>JavaScript实现简单 ...

  6. 进阶:案例六: Context Menu(静态 与 动态)

    实现: 1.add: 2.delete 3.add2 实现步骤: 1.新建属性display_text 2.创建layout 3.代码部分: add事件: METHOD onactionadd . D ...

  7. JS案例六_2:省市级联动

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  8. JS案例六_1:添加城市

    使用的相关知识点:对子节点的添加:document.appendClild() 文本节点的创建:document.createTextNode() 元素节点的创建:document.createEle ...

  9. Ulua_toLua_基本案例(二)_ScriptsFromFile

    在Untiy中用Lua.必需要LuaInterface. LuaInterface的介绍请看:点击打开链接 能够先光写Lua,生成.lua的纯文件. 再Unity中通过,luaState.DoFile ...

随机推荐

  1. jstorm之于storm

    关于流处理框架,在先前的文章汇总已经介绍过Strom,今天学习的是来自阿里的的流处理框架JStorm.简单的概述Storm就是:JStorm 比Storm更稳定,更强大,更快,Storm上跑的程序,一 ...

  2. mysql国内镜像下载网址

    http://mirrors.sohu.com/mysql/ http://mirrors.ustc.edu.cn/mysql-ftp/Downloads/ 开源镜像站点汇总 http://segme ...

  3. 快速掌握Vue.js使用【转】

    Vue.js是当下很火的一个JavaScript MVVM库,它是以数据驱动和组件化的思想构建的.相比于Angular.js,Vue.js提供了更加简洁.更易于理解的API,使得我们能够快速地上手并使 ...

  4. Android 8 声音调整过程

    记录Android 8声音调整过程. frameworks\base\services\core\java\com\android\server\policy\PhoneWindowManager.j ...

  5. Android Studio 出现 Build gradle project info

    导入Android Studio,一直停留在Build gradle project info.主要是因为google被墙,下载gradle很慢,有时候设置下载不成功. 参考链接 http://blo ...

  6. LintCode #1 A + B 问题

    分析:以3 + 5为例 3的二进制为 1 1,5的二进制为 1 0 1,可以这样做:1先给这两个数加起来不考虑进位,这样得到的结果为 1 1 0,会发现与^得到的结果相同,与是先给两个数 做^运算:2 ...

  7. 《经久不衰的Spring框架:@ResponseBody 中文乱码》(转)

    转载自:http://www.cnblogs.com/shanrengo/p/6429291.html 问题背景 本文并不是介绍@ResponseBody注解,也不是中文乱码问题的大汇总笔记,这些网上 ...

  8. 绚丽而实用的jQuery/CSS3应用及源码

    HTML5加入WEB以后,网页世界就变得丰富绚丽起来了,但是我们在项目应用中,不仅需要绚丽的动画效果,而且更需要有实用的价值.今天分享的一些jQuery/CSS3应用不仅绚丽,而且还比较实用,如果感兴 ...

  9. php + crontab 执行定时任务

    1.yii2中的console <?php /** * @link http://www.yiiframework.com/ * @copyright Copyright (c) 2008 Yi ...

  10. vue项目中使用md5.js及base64.js

    一.在项目根目录下安装 npm install --save js-base64 npm install --save js-md5 二.在项目文件中引入 import md5 from 'js-md ...