public void FunctionScopesTest() { LuaParser parser; var context = new LuaContext(); context.AddBasicLibrary(); context.AddIoLibrary(); parser = new LuaParser(context, "functionscopes.lua"); parser.Parse(); }
public void HelloWorldTest() { LuaParser parser; var context = new LuaContext(); context.AddBasicLibrary(); context.AddIoLibrary(); parser = new LuaParser(context, "helloworld.lua"); parser.Parse(); }
public void DoFileTest() { LuaParser parser; var context = new LuaContext(); context.AddBasicLibrary(); context.AddIoLibrary(); parser = new LuaParser(context, "dofile.lua"); parser.Parse(); }
public void MethodBinding() { LuaParser parser; var context = new LuaContext(); context.AddBasicLibrary(); context.AddIoLibrary(); double res = 0; var func = (Func<double, double>)((a) => { res = a; return a + 1; }); context.SetGlobal("test", LuaObject.FromDelegate(func)); parser = new LuaParser(context, new StringReader("test(123)")); parser.Parse(); Assert.AreEqual(123.0,res); }
public void MethodBinding() { LuaParser parser; var context = new LuaContext(); context.AddBasicLibrary(); context.AddIoLibrary(); double res = 0; var func = (Func <double, double>)((a) => { res = a; return(a + 1); }); context.SetGlobal("test", LuaObject.FromDelegate(func)); parser = new LuaParser(context, new StringReader("test(123)")); parser.Parse(); Assert.AreEqual(123.0, res); }