コード例 #1
0
        static void Main(string[] args)
        {
            var rawFeeds = new[]
            {
                FeedReader.Read("http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss.xml")
            };

            var feeds = rawFeeds.Select(feed => new
            {
                feed.Title,
                Items = feed.Items.Select(item => new
                {
                    item.Title,
                    item.Content
                }).ToArray()
            }).ToArray();

            using (var luaWriter = LuaWriter.Create("SavedVariables.lua", new LuaWriterSettings {
                Indent = true
            }))
            {
                var luaSerializer = new LuaSerializer();

                luaWriter.WriteStartAssignment("FEED_READER_FEEDS");
                luaSerializer.Serialize(luaWriter, feeds);
                luaWriter.WriteEndAssignment();
            }
        }
コード例 #2
0
        public void SaveFeeds()
        {
            Feed[] feeds = this.GetTopLevelFeeds();
            if (feeds != null)
            {
                using (var luaWriter = LuaWriter.Create(savedVariablesPath))
                {
                    var luaSerializer = new LuaSerializer();

                    luaWriter.WriteStartAssignment(feedsVariableName);
                    luaSerializer.Serialize(luaWriter, feeds);
                    luaWriter.WriteEndAssignment();
                }
            }
        }
コード例 #3
0
    // Use this for initialization
    void Start()
    {
        Dictionary <string, string> dic = new Dictionary <string, string>();

        dic["a"] = "aaaa";
        dic["b"] = "bbbb";
        dic["c"] = "cccc";
        string lua = LuaSerializer.Serialize(dic);

        Debug.Log(lua);
        List <ushort> sList = new List <ushort>()
        {
            1, 2, 0, 3, 4
        };
        string sLua = LuaSerializer.Serialize(sList);

        Debug.Log(sLua);
        MyClass myClass = new MyClass("myclass", 20);

        Debug.Log(LuaSerializer.Serialize(myClass));
    }
コード例 #4
0
ファイル: LuaSerializerTest.cs プロジェクト: hungmol/c4fbook
 public void SerializePrimitive()
 {
     luaSerializer.Serialize(luaWriter, "Hello world from Lua!");
 }
コード例 #5
0
 public LuaTable ToLuaTable() => LuaSerializer.Serialize(Table);