using LuaInterface; public class LuaExample { static void Main() { Lua lua = new Lua(); lua.DoText("print('Hello World!')"); } }
static void Main() { Lua lua = new Lua(); lua.DoText(@" function AddNumbers(a, b) return a + b end "); double result = (double)lua["AddNumbers"](2, 3); Console.WriteLine(result); }This example uses the DoText function to define a new Lua function "AddNumbers" that adds two numbers together. The result of calling this function is stored in a C# variable and printed to the console. In both examples, the LuaInterface package library is used to create a new Lua instance and execute Lua code using the DoText function.