Esempio n. 1
0
    public void set_valarrs(string v_header_name, int v_row, LuaTable v_table)
    {
        LuaArrayTable arr_info = v_table.ToArrayTable();
        StringBuilder sb       = new StringBuilder();

        for (int i = 1; i < arr_info.Length; i++)
        {
            var data = arr_info[i];
            if (sb.Length > 0)
            {
                sb.Append(',');
            }
            if (data != null)
            {
                if (data is string)
                {
                    sb.Append(Convert.ToString(data));
                }
                else
                {
                    ZFDebug.Info(string.Format("v_table[{0}] is not string", i));
                }
            }
            else
            {
                ZFDebug.Info(string.Format("v_table[{0}] = nil", i));
            }
        }
        set_val(v_header_name, v_row, sb.ToString());
    }
Esempio n. 2
0
    public void set_valarri(string v_header_name, int v_row, LuaTable v_table)
    {
        LuaArrayTable arr_info = v_table.ToArrayTable();
        StringBuilder sb       = new StringBuilder();
        int           idx      = 1;

        for (int i = 1; i < arr_info.Length; i++)
        {
            var data = arr_info[i];
            if (sb.Length > 0)
            {
                sb.Append(',');
            }
            if (data != null)
            {
                if (data is double || data is int)
                {
                    sb.Append((int)Convert.ToDouble(data));
                }
                else
                {
                    ZFDebug.Info(string.Format("v_table[{0}] is not number", idx));
                }
            }
            else
            {
                ZFDebug.Info(string.Format("v_table[{0}] = nil", idx));
            }
            idx = idx + 1;
        }
        set_val(v_header_name, v_row, sb.ToString());
    }
Esempio n. 3
0
        public ArrayData(LuaTable table)
        {
            Values = new object[table.Length];
            LuaArrayTable v = table.ToArrayTable();

            for (int i = 1, iMax = v.Length; i <= iMax; ++i)
            {
                Collect(i, v[i]);
            }
            //v.Dispose();
        }
Esempio n. 4
0
    public static LuaTable TestLuaCallByLuaArrayTable(LuaTable param)
    {
        LuaArrayTable arrayTable = param.ToArrayTable();

        foreach (var iter in arrayTable)
        {
            Debug.Log("array " + iter);
        }

        int      reference = SingletonMgr.GetLuaState().ToLuaRef();
        LuaTable ret       = new LuaTable(reference, SingletonMgr.GetLuaState());

        ret[1] = "array1";
        ret[2] = "array2";
        return(ret);
    }
Esempio n. 5
0
    public void set_valarr(string v_header_name, int v_row, LuaTable v_table)
    {
        LuaArrayTable arr_info = v_table.ToArrayTable();
        StringBuilder sb       = new StringBuilder();

        for (int i = 0; i <= arr_info.Length; i++)
        {
            if (sb.Length > 0)
            {
                sb.Append(',');
            }
            if (arr_info[i] != null)
            {
                sb.Append(arr_info[i]);
            }
        }
        set_val(v_header_name, v_row, sb.ToString());
    }
Esempio n. 6
0
        public static new List <WWWInfo> GetListByLua(LuaTable table)
        {
            List <WWWInfo> infos    = new List <WWWInfo>();
            LuaArrayTable  luaArray = new LuaArrayTable(table);

            luaArray.ForEach((obj) =>
            {
                LuaTable t = obj as LuaTable;
                if (null != t)
                {
                    infos.Add(new WWWUploadInfo(t));
                    t.Dispose();
                    t = null;
                }
            });
            luaArray.Dispose();
            luaArray = null;
            table.Dispose();
            table = null;
            return(infos);
        }
Esempio n. 7
0
    void TestAutoGen()
    {
        LuaTable tsheet = LuaManager.GetInstance().luaState.GetTable("config_sheet1");

        LuaDictTable dsheet = tsheet.ToDictTable();

        foreach (var kv in dsheet)
        {
            //Debug.LogError("dsheet  " + kv.Key);

            LuaTable      tfield3 = (kv.Value as LuaTable)["field3"] as LuaTable;
            LuaArrayTable afield3 = tfield3.ToArrayTable();
            //afield3.ForEach((obj) => { Debug.LogError("obj " + System.Convert.ToInt32(obj)); });
            for (int i = 1; i <= afield3.Length; i++)
            {
                Debug.LogError("dsheet  " + kv.Key + " obj " + System.Convert.ToInt32(afield3[i]));
            }

            ArrayData ad = new ArrayData(tfield3);
            Debug.LogError("ad " + ad.GetString(0));
        }
    }
Esempio n. 8
0
 public static LuaTable GetLuaTable(this LuaArrayTable luaArrayTable, int key)
 {
     return(luaArrayTable[key] as LuaTable);
 }