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 ...
随机推荐
- RavenDb学习(六)查询补充特性
.延迟加载 原来的查询方式如下: IEnumerable<User> users = session .Query<User>() .Where(x => x.Name ...
- 【转载】解决Windows和Ubuntu时间不一致的问题
大家在切换操作系统的时候会发现一个问题, Windows 和Ubuntu的时间会出现不一致的情况.在 Windows 中把时间设置正确了过后,回到在 Ubuntu 后系统的时间又不一样了,在 Ubun ...
- Git教程首页
Git 教程 Git 是一个分布式的版本控制和源代码管理系统,强调速度. Git 最初由Linus Torvalds设计和开发为Linux内核开发管理代码. Git是GNU通用公共许可证版本2的条款下 ...
- TiKV 源码解析系列——如何使用 Raft
本系列文章主要面向 TiKV 社区开发者,重点介绍 TiKV 的系统架构,源码结构,流程解析.目的是使得开发者阅读之后,能对 TiKV 项目有一个初步了解,更好的参与进入 TiKV 的开发中. 需要注 ...
- Matlab——plot polyfit polyval
p=polyfit(x,y,m) 其中, x, y为已知数据点向量, 分别表示横,纵坐标, m为拟合多项式的次数, 结果返回m次拟合多项式系数, 从高次到低次存放在向量p中. y0=polyval(p ...
- Java设计模式(21)访问模式(Visitor者模式)
Visitor定义:作用于某个对象群中各个对象的操作.它可以使你在不改变这些对象本身的情况下,定义作用于这些对象的新操作. 在Java中,Visitor模式实际上是分离了collection结构中的元 ...
- SpringMVC深度探险(四) —— SpringMVC核心配置文件详解
在上一篇文章中,我们从DispatcherServlet谈起,最终为读者详细分析了SpringMVC的初始化主线的全部过程.整个初始化主线的研究,其实始终围绕着DispatcherServlet.We ...
- Sword pcre库使用
#include <stdlib.h> #include <string.h> #include "regularhelper.h" #include &q ...
- (笔记)Linux下的简单CGI编程
为什么要进行CGI编程? 在HTML中,当客户填写了表单,并按下了发送(submit)按钮后,表单的内容被发送到了服务器端,一般的,这时就需要有一个服务器端脚本来对表单的内容进行一些处理,或者是把它 ...
- android 拍照声音文件路径
Android拍照音频文件位于\frameworks\base\data\sounds\effects目录,更具不同的平台区分不同音频文件. 例如拍照声音文件位于\frameworks\base\da ...