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 ...
随机推荐
- linux安装setup
安装setuptool #yum install setuptool 系统服务管理 #yum install ntsysv 防火墙设置.网络设置 #yum install ipt ...
- Android训练课程(Android Training) - 使用Volley传输网络数据(Transmitting Network Data Using Volley)
使用Volley传输网络数据(Transmitting Network Data Using Volley) Volley 是一个 HTTP 库,它使得在Android应用程序中操作网络更容易,是重要 ...
- SimpleDraweeView 设置圆角不生效问题
采用的是xml配置 roundedCornerRadius 参数方法 adverPic.setImageURI("http://xx.xx.xx.xx/123.jpg"); 设置c ...
- JS Window对象操作思维导图
- 如何配置propagation
配置spring事务代理时的事务属性. <prop key=“get*”>PROPAGATION_REQUIRED,readOnly</prop> 表示类方法名称是以get开头 ...
- Prolog学习:用八卦的精神走进Prolog
最近枕头书是<七周七语言:理解多种编程范型>这本,前面两章分别看了Ruby和IO,都是命令式语言.虽然它们在语法上跟之前接触过的C,C#,Java这些C家族的语言差别很大,但是编程范型却是 ...
- Spring JDBC处理BLOB类型字段
以下示例将演示使用spring jdbc更新BLOB类型的字段值,即更新student表中的可用记录. student表的结构如下 - CREATE TABLE student( ID INT NOT ...
- Windows查看占用端口的进程及其对应的应用程序并关闭之
^_^ C:\Users\dsp> C:\Users\dsp>netstat -ano | findstr " TCP LISTENING TCP TIME_WAIT TCP T ...
- 开源轻量级分布式文件系统--FastDFS
FastDFS一个高效的分布式文件系统 分布式文件系统FastDFS原理介绍 分布式文件系统FastDFS设计原理 FastDFS安装.配置.部署(一)-安装和部署 分布式文件系统 - FastDFS ...
- C#网络唤醒
什么是网络唤醒 网络唤醒实现了对网络的集中管理,即在任何时刻,网管中心的IT管理人员可以经由网络远程唤醒一台处于休眠或关机状态的计算机.使用这一功能,IT管理人员可以在下班后,网络流量最小以及企业的正 ...