/////////////////////////////////////////////////////////////////////// /// <summary> /// Constructor - creates a new lua state. /// </summary> public LuaState() { mLuaFunctionCallAdapterDelegate = functionCallAdapter; mgcAdapterDelegate = gcAdapter; mtostringAdapterDelegate = tostringAdapter; meqAdapterDelegate = eqAdapter; L = LuaDll.luaL_newstate(); LuaDll.luaL_openlibs(L); LuaDll.lua_atpanic(L, mPanicFunctionDelegate); // Redirect stderr from the Lua DLL to an error file. //FileStream fs = new FileStream("error.txt", FileMode.Create); //mOutputRef = new HandleRef(fs, fs.Handle); //SetStdHandle(-12, mOutputRef); // Install a new print function (to capture stdout) LuaDll.lua_register(L, "print", sLuaPrintDelegate); }