CsCallLua.lua
function add()
print("add");
end
C#
using System;
using System.Collections.Generic;
using UnityEngine;
using XLua;
public class CsCallLua : MonoBehaviour {
void Start () {
var luaenv = new XLua.LuaEnv();
luaenv.DoString("require 'CsCallLua'");
// delegate
Action ac = luaenv.Global.Get<Action>("add");
ac();
ac = null; //释放
luaenv.Dispose();
}
}