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. 局域网内的机器不能ping通虚拟机,但是虚拟机可以ping通局域网的机器

    将虚拟机的网络网络适配器模式改成桥接模式即可: 一.选择虚拟机里面的设置: 二.在虚拟机设置界面将网络适配器模式改成桥接模式

  2. linux Nginx服务开机自启

    linux Nginx服务开机自启 Nginx 是一个很强大的高性能Web和反向代理服务器.虽然使用命令行可以对nginx进行各种操作,比如启动等,但是还是根据不太方便.下面介绍在linux下安装后, ...

  3. Scrapy安装错误:Microsoft Visual C++ 14.0 is required

    问题描述 当前环境win10,python_3.6.1,64位. 在windows下,在dos中运行pip install Scrapy报错: building 'twisted.test.raise ...

  4. Spring配置文件<context:property-placeholder>标签使用漫谈

    <context:property-placeholder>标签提供了一种优雅的外在化参数配置的方式,不过该标签在Spring配置文件中只能存在一份!!! 众所周知,Spring容器是采用 ...

  5. C#里的SubString和Convert.ToDateTime

    1.C#里的SubString String.SubString(int   index,int   length) index:开始位置,从0开始 length:你要取的子字符串的长度 2.C#语言 ...

  6. SpagoBI 教程 Lesson 5: Creating a dashboard with BIRT and SpagoBI

    SpagoBI Lesson 5: Creating a dashboard with BIRT and SpagoBI Creating a dashboard with BIRT and Spag ...

  7. Apache Flume 学习

    Apache Flume,又称Flume NG (next generation),前身是Cloudera公司的Flume项目 -- 又称Flume OG. 这货的功能就是从源中将数据收集到指定的目的 ...

  8. 嵌入式开发之zynq---Zynq PS侧DMA驱动

    http://xilinx.eetrend.com/blog/10760 http://xilinx.eetrend.com/blog/10787

  9. C#连接SQL数据库代码

    感觉很有必要总结一下 一:C# 连接SQL数据库  Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername; ...

  10. linux rinetd 端口转发部署

    linux下简单好用的工具rinetd,实现端口映射/转发/重定向 Rinetd是为在一个Unix和Linux操作系统中为重定向传输控制协议(TCP)连接的一个工具.Rinetd是单一过程的服务器,它 ...