Exemple #1
0
        protected override LuaValue _OnGetLuaValue()
        {
            LuaDouble rtn = new LuaDouble();

            if (_isEmpty)
            {
                rtn.init(0);
            }
            else
            {
                rtn.init(_data);
            }
            return(rtn);
        }
Exemple #2
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);
        }
Exemple #3
0
        protected override LuaValue _OnGetLuaValue()
        {
            switch (_type)
            {
            case NumberType.Integer:
                LuaInteger iRtn = new LuaInteger();
                iRtn.init(_isEmpty ? 0 : _iData);
                return(iRtn);

            case NumberType.Double:
                LuaDouble rtn = new LuaDouble();
                rtn.init(_isEmpty ? 0 : _data);
                return(rtn);
            }
            Debug.Exception("NumberVal类型错误");
            return(new LuaNil());
        }