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(); } }
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(); } } }
// 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)); }
public void SerializePrimitive() { luaSerializer.Serialize(luaWriter, "Hello world from Lua!"); }
public LuaTable ToLuaTable() => LuaSerializer.Serialize(Table);