xlua-Unity中执行lua代码
using System.Collections;using System.Collections.Generic;using UnityEngine;using XLua;//引入命名空间/** Author:W
* 执行Lua代码
*
*/publicclassLuaRunTest:MonoBehaviour{privateLuaEnv luaEnv;// Start is called before the first frame updatevoidStart(){//创建lua运行环境实例
luaEnv =newLuaEnv();//执行lua代码
luaEnv.DoString("print('Hello Unity!')");}privatevoidOnDestroy(){//释放lua环境实例
luaEnv.Dispose();}}运行结果截图:
页:
[1]