public static string Generate(string templateContent, Dictionary <string, object> envDic) { LogManager.CreateMgr(); LogManager.GetInstance().AddAppender(new ConsoleAppender()); LogManager.GetInstance().AddAppender(new FileAppender()); LuaEnv luaEnv = new LuaEnv(); luaEnv.DoString(Properties.Resources.TemplateCommon); LuaTable envTable = LuaTable.CreateFromDictionary(luaEnv, envDic); luaEnv.Global.Set("context", envTable); string genCode = Compiler.Run(luaEnv, templateContent); envTable.Dispose(); luaEnv.Dispose(); LogUtil.Info(genCode); LogManager.DestroyMgr(); return(genCode); }
public static string Generate(string templateContent, Dictionary <string, object> envDic) { LuaEnv luaEnv = new LuaEnv(); luaEnv.DoString(Properties.Resources.TemplateCommon); LuaTable envTable = LuaTable.CreateFromDictionary(luaEnv, envDic); luaEnv.Global.Set("context", envTable); string genCode = Compiler.Run(luaEnv, templateContent); envTable.Dispose(); luaEnv.Dispose(); return(genCode); }