Пример #1
0
 //lua中调用此方法执行已配置的内部或者外部接口
 public override object LuaInvokeDynamicApi(string code, LuaTable table)
 {
     try
     {
         IDictionary <string, object> parameters = LuaScriptRunner.LuaTableToCSharpData <IDictionary <string, object> >(table);
         object result    = this.DynamicFetch(code, parameters);
         string luaScript = LuaScriptRunner.ToLuaScript(result);
         Lua    lua       = GetLua();
         var    returns   = lua.DoString("return " + luaScript);
         return(returns[0]);
     }
     catch
     {
         _logger.LogError("Lua调用接口异常");
         throw;
     }
 }
Пример #2
0
 public override object LuaExecuteSql(string sql, int codeKind, LuaTable table)
 {
     try
     {
         IDictionary <string, object> parameters = LuaScriptRunner.LuaTableToCSharpData <IDictionary <string, object> >(table);
         object result    = this.ExecuteSql(sql, codeKind, parameters);
         string luaScript = LuaScriptRunner.ToLuaScript(result);
         Lua    lua       = GetLua();
         var    returns   = lua.DoString("return " + luaScript);
         return(returns[0]);
     }
     catch
     {
         _logger.LogError("Lua执行SQL语句异常");
         throw;
     }
 }
Пример #3
0
        public virtual string ObjectToLuaScriptString(object obj)
        {
            string luaScriptString = LuaScriptRunner.ToLuaScript(obj);

            return(luaScriptString);
        }