using System.Collections;using System.Collections.Generic;using UnityEngine;using XLua;publicclassLesson9_CallLuaTable:MonoBehaviour{// Start is called before the first frame updatevoidStart(){
LuaMgr.GetInstance().Init();
LuaMgr.GetInstance().DoLuaFile("Main");//不建议使用LuaTable和LuaFunction 效率低//引用对象LuaTable table = LuaMgr.GetInstance().Global.Get<LuaTable>("testClas");
Debug.Log(table.Get<int>("testInt"));
Debug.Log(table.Get<bool>("testBool"));
Debug.Log(table.Get<float>("testFloat"));
Debug.Log(table.Get<string>("testString"));
table.Get<LuaFunction>("testFun").Call();//改 引用
table.Set("testInt",55);
Debug.Log(table.Get<int>("testInt"));LuaTable table2 = LuaMgr.GetInstance().Global.Get<LuaTable>("testClas");
Debug.Log(table2.Get<int>("testInt"));
table.Dispose();
table2.Dispose();}// Update is called once per framevoidUpdate(){}}
通过LuaTable Xlua提供给我们的类 来获取Lua中的表 得和改变量 通过 Get和Set引用设置用完了 要Dispose不建议使用using System.Collections;using System.Collections.Generic;using UnityEngine;using XLua;public class Lesson9_CallLuaTable : MonoBehaviour{ // Start is called before the fi.