一、新建项目:luademo
安装包:<PackageReference Include="NLua" Version="1.7.3" />
using NLua;
using System;
namespace luademo
{
internal class Program
{
static void Main(string[] args)
{
Lua state = new Lua();
for (int i = 0; i < 1000; i++)
{
state["x"] = i;
var res = state.DoString("return 10 + x*(5 + 2)")[0];
Console.WriteLine(res);
}
}
}
}