public void Save(string path) { try { Directory.CreateDirectory(path); } catch {} ; try { Directory.CreateDirectory(path + "/units"); } catch {} ; foreach (var s in Directory.GetFiles(path + "/units", "*.lua")) { try { File.Delete(s); } catch {} ; } foreach (DictionaryEntry de in Units) { string key = de.Key.ToString().ToLower(); string s = String.Format("unitDef = {0}\r\n\r\nreturn lowerkeys({{ {1} = unitDef }})\r\n", TableProxy.Export((LuaTable)de.Value, 0), key); File.WriteAllText(path + "/units/" + key + ".lua", s); } }
public string GetUnitSource(string unitId) { return(TableProxy.Export((LuaTable)Units[unitId], 0)); }