C#调用LuaTable

C#

using UnityEngine;
using XLua;
public class CsCallLua : MonoBehaviour {
	void Start () {
        var luaenv = new XLua.LuaEnv();
        luaenv.DoString("require 'CsCallLua'");
        // luatable
        LuaTable t = luaenv.Global.Get<LuaTable>("teather");
        print(t.Get<string>("name")+"-LuaTable");
        luaenv.Dispose();
    }   
}

Lua

teather = {
	--字典
	name = "cjh",
	age = 18,
	isHandsome = true,
	--list
	3,4,5
}
发布了205 篇原创文章 · 获赞 8 · 访问量 5万+

猜你喜欢

转载自blog.csdn.net/cuijiahao/article/details/103905171