Ulua_toLua_基本案例(六)_LuaCoroutine2
来源:互联网 发布:质检总局网络 编辑:程序博客网 时间:2024/06/05 22:09
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; }}
0 0
- Ulua_toLua_基本案例(六)_LuaCoroutine2
- Ulua_toLua_基本案例(一)
- Ulua_toLua_基本案例(二)_ScriptsFromFile
- Ulua_toLua_基本案例(四)_AccessingLuaVariables
- Ulua_toLua_基本案例(五)_LuaCoroutine
- Ulua_toLua_基本案例(七)_LuaThread
- Ulua_toLua_基本案例(八)_LuaAccessingArray
- Ulua_toLua_基本案例(九)_LuaDictionary
- Ulua_toLua_基本案例(三)_CallLuaFunction
- 【Hadoop入门学习系列之六】HBase基本架构、编程模型和应用案例
- JBPM案例详解(六)
- Servlet案例六
- Unity3D 学习案例六
- day04_案例五六
- RabbitMQ案例六之Topic
- activemq 基本使用案例
- 03_php_基本案例
- 03_php_基本案例
- JavaScript的适用场合有哪些
- C++ 虚函数表解析
- window对象关系图以及DOM操作
- 1.1土到爆的HelloWorld
- Andorid APK反逆向解决方案:梆梆加固原理探寻
- Ulua_toLua_基本案例(六)_LuaCoroutine2
- java中接口的使用
- Ulua_toLua_基本案例(七)_LuaThread
- Eclipse常用的快捷键在AS中的对应
- Java多态性理解
- Java进阶06 容器
- 将手机号,银行卡,身份证只显示前三位和后四位。为了保护用户的信息
- mysql存储过程
- C语言实现单链表节点的删除(带头结点)