<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://miniscript.org/w/index.php?action=history&amp;feed=atom&amp;title=File.writeLines</id>
	<title>File.writeLines - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://miniscript.org/w/index.php?action=history&amp;feed=atom&amp;title=File.writeLines"/>
	<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=File.writeLines&amp;action=history"/>
	<updated>2026-04-10T15:04:56Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.34.0</generator>
	<entry>
		<id>http://miniscript.org/w/index.php?title=File.writeLines&amp;diff=769&amp;oldid=prev</id>
		<title>JoeStrout at 22:14, 15 August 2021</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=File.writeLines&amp;diff=769&amp;oldid=prev"/>
		<updated>2021-08-15T22:14:49Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 22:14, 15 August 2021&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l2&quot; &gt;Line 2:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 2:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;c&amp;gt;file.writeLines&amp;lt;/c&amp;gt; will create or overwrite the file path passed to it. This function &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;does not appear to return anything other then ''&lt;/del&gt;null&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;''&lt;/del&gt;.  &lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;c&amp;gt;file.writeLines&amp;lt;/c&amp;gt; will create or overwrite the file path passed to it. This function &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;returns [[&lt;/ins&gt;null&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;]] on success, or an error string in the event of an error&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== Arguments ===&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== Arguments ===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=File.writeLines&amp;diff=666&amp;oldid=prev</id>
		<title>Mantic: Initial file.writeLines page.</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=File.writeLines&amp;diff=666&amp;oldid=prev"/>
		<updated>2021-01-24T04:03:08Z</updated>

		<summary type="html">&lt;p&gt;Initial file.writeLines page.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;In [[Mini Micro]] and [[command-line MiniScript]], the &amp;lt;c&amp;gt;[[file]].writeLines&amp;lt;/c&amp;gt; function writes a single value, or an array of values, to a file. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;c&amp;gt;file.writeLines&amp;lt;/c&amp;gt; will create or overwrite the file path passed to it. This function does not appear to return anything other then ''null''. &lt;br /&gt;
&lt;br /&gt;
=== Arguments ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter Name !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| filePath || an absolute or relative path of the file or directory to be written to. &lt;br /&gt;
|-&lt;br /&gt;
| content || a single variable (of any type) to be written to the file. If it is an array, it will be written out with a newline after each item in the array. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
See also: [[file.readLines]]&lt;br /&gt;
&lt;br /&gt;
== Example 1 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;foods = [&lt;br /&gt;
  &amp;quot;fish&amp;quot;,&lt;br /&gt;
  &amp;quot;grapes&amp;quot;,&lt;br /&gt;
  &amp;quot;dreams&amp;quot;,&lt;br /&gt;
  &amp;quot;head cheese&amp;quot;,&lt;br /&gt;
  &amp;quot;cucumber&amp;quot;,&lt;br /&gt;
  &amp;quot;sea cucumber&amp;quot;,&lt;br /&gt;
  &amp;quot;Welsh rabbit&amp;quot;,&lt;br /&gt;
]&lt;br /&gt;
&lt;br /&gt;
file.writeLines &amp;quot;myFavoriteFoods.txt&amp;quot;, foods&lt;br /&gt;
&lt;br /&gt;
file.writeLines &amp;quot;myAge.txt&amp;quot;, 100&lt;br /&gt;
&lt;br /&gt;
file.writeLines &amp;quot;../myParentsAge.txt&amp;quot;, 242&lt;br /&gt;
&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Example 2 ==&lt;br /&gt;
&lt;br /&gt;
This silly program will overwrite itself each time it is ran, incrementing the count. &lt;br /&gt;
Name it &amp;lt;c&amp;gt;selfcounter.ms&amp;lt;/c&amp;gt; and give it a whirl!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;count = 0&lt;br /&gt;
&lt;br /&gt;
// Increment count and report.&lt;br /&gt;
count = count + 1&lt;br /&gt;
print &amp;quot;This file has been ran: &amp;quot; + count + &amp;quot; time(s)!&amp;quot;&lt;br /&gt;
&lt;br /&gt;
// Read source code of this file, modify it, and write it back out. 	&lt;br /&gt;
code = file.readLines(&amp;quot;selfcounter.ms&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
code[0] = &amp;quot;count = &amp;quot; + count&lt;br /&gt;
&lt;br /&gt;
file.writeLines &amp;quot;selfcounter.ms&amp;quot;, code&lt;br /&gt;
&lt;br /&gt;
// Reload entire file. &lt;br /&gt;
load &amp;quot;selfcounter.ms&amp;quot;&lt;br /&gt;
&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:Command-Line MiniScript]]&lt;/div&gt;</summary>
		<author><name>Mantic</name></author>
		
	</entry>
</feed>