命名空间 using LuaInterface;
//实例化LUA类
Lua newlua = new Lua();
//第一个SecondTest为LUA脚本 第二个为C#内函数
//表示LUA脚本里的SecondTestB等于C#函数里的SecondTest
netlua.RegisterFunction("SecondTestB", this, this.GetType().GetMethod("SecondTestA"));
//解析指定脚本
netlua.DoFile(@"test.lua");
//调用LUA脚本内的函数
netlua.GetFunction("FirstTest").Call();
//C#函数
public void SecondTestA(string str)
{
MessageBox.Show(str);
}
/*lua脚本*/
function FirstTest() SecondTestB("hello") end