ps:本文主要是uLuaFramework_NGUI插件介绍使用
一、LuaFramework-》Tolua-》Examples-》01_HelloWorld
using UnityEngine;
using LuaInterface;
using System;
public class HelloWorld : MonoBehaviour
{
void Awake()
{
//------------------------------------------------准备
//创建一个Lua运行环境,来跑我们的lua脚本
LuaState lua = new LuaState();
//lua运行环境的初始化工作
lua.Start();
//------------------------------------------------处理脚本
string hello =
@"
print('hello tolua#')
";
//用lua环境执行脚本(hello脚本)
lua.DoString(hello, "HelloWorld.cs");
//-------------------------------------------------开始准备销毁
//判断一下在lua环境中是否还有其他需要运行的脚本
bool checkOver = lua.CheckTop();
Debug.Log("checkOver:"+checkOver);
//lua运行环境对象的销毁
lua.Dispose();
//再把对象赋空
lua = null;
}
}