Thanks to both of you, I found what I was looking for using LuaInterface
Here's a datastructure in Lua I wanted to read ("c:sample.lua"):
TestValues = {
NumbericOneMillionth = 1e-006,
NumbericOnehalf = 0.5,
NumbericOne = 1,
AString = "a string"
}
Here's some sample code reading that Lua datastructure using LuaInterface:
Lua lua = new Lua();
var result = lua.DoFile("C:\sample.lua");
foreach (DictionaryEntry member in lua.GetTable("TestValues")) {
Console.WriteLine("({0}) {1} = {2}",
member.Value.GetType().ToString(),
member.Key,
member.Value);
}
And here's what that sample code writes to the console:
(System.String) AString = a string
(System.Double) NumbericOneMillionth = 1E-06
(System.Double) NumbericOnehalf = 0.5
(System.Double) NumbericOne = 1
To figure out how to use the library I opened up the LuaInterface.dll in Reflector and google'd the member functions.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…