Пример #1
0
        public void addData(LuaValue v_val)
        {
            LuaNil nilVal = v_val as LuaNil;

            if (nilVal == null || nilVal.IsPrint == true)
            {
                m_data.Add(v_val);
            }
        }
Пример #2
0
 public virtual LuaValue GetLuaValue()
 {
     if (_isMiss)
     {
         LuaNil rtn = new LuaNil();
         rtn.init(false);
         return(rtn);
     }
     if (_isNull)
     {
         LuaNil rtn = new LuaNil();
         rtn.init(true);
         return(rtn);
     }
     return(_OnGetLuaValue());
 }
Пример #3
0
        protected bool fill_luatable(LuaMap v_map, Lua.LuaTable v_luatable)
        {
            foreach (KeyValuePair <object, object> i in v_luatable)
            {
                LuaValue val = null;
                if (i.Value is Lua.LuaTable)
                {
                    LuaMap newTable = new LuaMap();
                    newTable.init(_isStretch, ExportSheetBin.ROW_MAX_ELEMENT);
                    fill_luatable(newTable, (Lua.LuaTable)i.Value);
                    val = newTable;
                }
                else
                {
                    if (i.Value is double)
                    {
                        val = new LuaDouble(Convert.ToDouble(i.Value));
                    }
                    else if (i.Value is string)
                    {
                        val = new LuaString(Convert.ToString(i.Value));
                    }
                    else if (i.Value is bool)
                    {
                        val = new LuaBoolean(Convert.ToBoolean(i.Value));
                    }
                    else if (i.Value == null)
                    {
                        val = new LuaNil();
                    }
                    else
                    {
                        Debug.Exception("出现了无法识别的luavalue,键是{0}", i.Key);
                    }
                }

                if (i.Key is int || i.Key is double)
                {
                    v_map.addData(Convert.ToInt32(i.Key), val);
                }
                else if (i.Key is string)
                {
                    v_map.addData(Convert.ToString(i.Key), val);
                }
            }
            return(true);
        }
Пример #4
0
        //当添加相同键时,return false
        public bool addData(int v_ikey, LuaValue v_val, string v_note = null)
        {
            LuaNil nilVal = v_val as LuaNil;

            if (nilVal == null || nilVal.IsPrint == true)
            {
                if (!m_idata.ContainsKey(v_ikey))
                {
                    m_idata.Add(v_ikey, v_val);
                    return(true);
                }
                else
                {
                    m_idata[v_ikey] = v_val;
                    return(false);
                }
            }
            return(true);
        }