<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://miniscript.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Redspark</id>
	<title>MiniScript Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="http://miniscript.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Redspark"/>
	<link rel="alternate" type="text/html" href="http://miniscript.org/wiki/Special:Contributions/Redspark"/>
	<updated>2026-05-13T08:43:06Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.34.0</generator>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Love_for_Mini&amp;diff=1443</id>
		<title>Love for Mini</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Love_for_Mini&amp;diff=1443"/>
		<updated>2025-12-26T20:03:25Z</updated>

		<summary type="html">&lt;p&gt;Redspark: Initial Page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| class=&amp;quot;plainrowheaders&amp;quot; border=&amp;quot;0&amp;quot; cellpadding=&amp;quot;10&amp;quot;&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; | [[File: MiniLoveIcon.png |80px]]&lt;br /&gt;
| style=&amp;quot;font-size: 150%;&amp;quot; valign=&amp;quot;middle&amp;quot; | '''Have you been using MiniScript or Mini Micro and like them?  Show your support by posting a like and even a review at any of the following websites:'''&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* '''[https://alternativeto.net/software/mini-micro/about/#post-165364 AlternativeTo.com]'''&lt;/div&gt;</summary>
		<author><name>Redspark</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=File:MiniLoveIcon.png&amp;diff=1442</id>
		<title>File:MiniLoveIcon.png</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=File:MiniLoveIcon.png&amp;diff=1442"/>
		<updated>2025-12-26T19:40:13Z</updated>

		<summary type="html">&lt;p&gt;Redspark: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Mini Hugging a Heart&lt;/div&gt;</summary>
		<author><name>Redspark</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Sound&amp;diff=1441</id>
		<title>Sound</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Sound&amp;diff=1441"/>
		<updated>2025-12-25T14:27:53Z</updated>

		<summary type="html">&lt;p&gt;Redspark: Added amp() method&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In [[Mini Micro]], the &amp;lt;msinline&amp;gt;Sound&amp;lt;/msinline&amp;gt; class both represents individual audio clips that can be played, and a handful of global sound-related properties and methods.&lt;br /&gt;
&lt;br /&gt;
=== Methods and properties called on Sound ===&lt;br /&gt;
&lt;br /&gt;
Use the following properties and methods directly on the Sound class itself.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Method or Property !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| [[Sound.sineWave]] || represents a sine wave (pure tone)&lt;br /&gt;
|-&lt;br /&gt;
| [[Sound.triangleWave]] || represents a triangle wave (almost pure)&lt;br /&gt;
|-&lt;br /&gt;
| [[Sound.sawtoothWave]] || represents a sawtooth wave (slightly &amp;quot;buzzier&amp;quot;)&lt;br /&gt;
|-&lt;br /&gt;
| [[Sound.squareWave]] || represents a square wave (most buzzy/retro sound)&lt;br /&gt;
|-&lt;br /&gt;
| [[Sound.noiseWave]] || creates a pseudo-random &amp;quot;static&amp;quot; waveform&lt;br /&gt;
|-&lt;br /&gt;
| [[Sound.stopAll]] || stops all currently playing sounds&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Methods and properties used with Sound objects ===&lt;br /&gt;
&lt;br /&gt;
Use these methods on Sound instances, created with &amp;lt;c&amp;gt;[[new]] Sound&amp;lt;/c&amp;gt; or &amp;lt;c&amp;gt;[[file.loadSound]]&amp;lt;/c&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Method or Property !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| [[Sound.duration]] || length of the sound, in seconds&lt;br /&gt;
|-&lt;br /&gt;
| [[Sound.freq]] || sound frequency, i.e. how many times the waveform is repeated per second&lt;br /&gt;
|-&lt;br /&gt;
| [[Sound.envelope]] || volume over time (0 to 1)&lt;br /&gt;
|-&lt;br /&gt;
| [[Sound.waveform]] || shape of waveform over an audio cycle&lt;br /&gt;
|-&lt;br /&gt;
| [[Sound.fadeIn]] || length of the fade-in period when the sound begins, in seconds&lt;br /&gt;
|-&lt;br /&gt;
| [[Sound.fadeOut]] || length of the fade-out period when the sound ends, in seconds&lt;br /&gt;
|-&lt;br /&gt;
| [[Sound.loop]] || true (1) to set the sound to repeat indefinitely until stopped&lt;br /&gt;
|-&lt;br /&gt;
| [[Sound.init]] ''duration'',''freq'',''envelope'',''waveform'' || initialize a sound with the given parameters&lt;br /&gt;
|-&lt;br /&gt;
| [[Sound.mix]] ''sound2'',''level'' || add another synthesized sound into this one&lt;br /&gt;
|-&lt;br /&gt;
| [[Sound.play]] ''volume'',''pan'',''speed'' || play this sound (looping if [[Sound.loop|.loop]] is true)&lt;br /&gt;
|-&lt;br /&gt;
| [[Sound.adjust]] ''volume'',''pan'',''speed'' || change volume/pan/speed of a playing sound&lt;br /&gt;
|-&lt;br /&gt;
| [[Sound.isPlaying]] || returns true (1) while sound is playing, false (0) otherwise&lt;br /&gt;
|-&lt;br /&gt;
| [[Sound.stop]] || stop playing this sound&lt;br /&gt;
|-&lt;br /&gt;
| [[Sound.amp]] || returns the current amplitude of the playing sound.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
See also: &amp;lt;c&amp;gt;[[file.loadSound]]&amp;lt;/c&amp;gt;; &amp;lt;c&amp;gt;[[noteFreq]]&amp;lt;/c&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:Soda]]&lt;/div&gt;</summary>
		<author><name>Redspark</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=BmfFonts&amp;diff=1440</id>
		<title>BmfFonts</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=BmfFonts&amp;diff=1440"/>
		<updated>2025-11-22T15:02:56Z</updated>

		<summary type="html">&lt;p&gt;Redspark: Updated URL&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This module defines a Font class which can read fonts in [http://bmf.wz.cz:8080/?page=format BMF format] version 1.1 or 1.2. Version 1.2 is a recent but significant upgrade, adding support for non-ASCII Unicode characters, kerning, and an alpha channel for anti-aliased fonts.&lt;br /&gt;
&lt;br /&gt;
If you run bmfFonts.demo (or load and run the module directly instead of using import), it will look for the fonts folder, and draw a string with each one. The final font will be drawn at 3X scale at the bottom of the screen. &lt;br /&gt;
&lt;br /&gt;
== Classes ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| [[bmfFonts.Font|Font]] || Stores all data about a particular font.&lt;br /&gt;
|-&lt;br /&gt;
| [[bmfFonts.CharData|CharData]] || Stores all data about a single character in a specific font.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&amp;lt;ms&amp;gt;&lt;br /&gt;
import &amp;quot;bmfFonts&amp;quot;&lt;br /&gt;
clear&lt;br /&gt;
// Load a font&lt;br /&gt;
f = bmfFonts.Font.load(&amp;quot;/sys/fonts/Arial14Bold.bmf&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
// Print a string in that font to gfx&lt;br /&gt;
f.print &amp;quot;Hello world!&amp;quot;, 20, 500&lt;br /&gt;
&lt;br /&gt;
// Get a character image, and make a Sprite out of it&lt;br /&gt;
spr = new Sprite&lt;br /&gt;
spr.image = f.getCharImage(&amp;quot;R&amp;quot;)&lt;br /&gt;
spr.x = 600&lt;br /&gt;
spr.y = 500&lt;br /&gt;
spr.scale = 3&lt;br /&gt;
spr.rotation = 30&lt;br /&gt;
display(4).sprites.push spr&lt;br /&gt;
&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:Sys Modules]]&lt;/div&gt;</summary>
		<author><name>Redspark</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=File.open&amp;diff=1438</id>
		<title>File.open</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=File.open&amp;diff=1438"/>
		<updated>2025-09-29T15:05:39Z</updated>

		<summary type="html">&lt;p&gt;Redspark: Removed fopen() reference&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In [[Mini Micro]] and [[command-line MiniScript]], the &amp;lt;c&amp;gt;[[file]].open&amp;lt;/c&amp;gt; function returns a [[FileHandle]] object that enables further reads, writes, or updates of the file.&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 !! Default Value !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| path || &amp;quot;&amp;quot; || full or partial path to the file of interest&lt;br /&gt;
|-&lt;br /&gt;
| mode || &amp;quot;r+&amp;quot; || file mode (see below)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== File Modes ===&lt;br /&gt;
&lt;br /&gt;
The second parameter to &amp;lt;c&amp;gt;[[file]].open&amp;lt;/c&amp;gt; specifies whether the file is opened for reading, writing, or both.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Mode !! Description !! Starting Position&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;tt&amp;gt;r&amp;lt;/tt&amp;gt; || Opens an existing text file for reading. If the file does not exist, it returns null. || beginning&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;tt&amp;gt;w&amp;lt;/tt&amp;gt; || Opens a text file for writing. If the file exists, its contents are truncated (emptied). If the file does not exist, a new file is created. || beginning&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;tt&amp;gt;a&amp;lt;/tt&amp;gt; || Opens a text file for appending. Data is written to the end of the file. If the file does not exist, a new file is created. || end&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;tt&amp;gt;r+&amp;lt;/tt&amp;gt; || Opens an existing text file for both reading and writing. The file must exist.|| beginning&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;tt&amp;gt;w+&amp;lt;/tt&amp;gt;  || Opens a text file for both writing and reading. If the file exists, its contents are truncated. If the file does not exist, a new file is created. || beginning&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;tt&amp;gt;a+&amp;lt;/tt&amp;gt; || Opens a text file for both appending and reading. Data is written to the end of the file. If the file does not exist, a new file is created. || end&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
When a file is opened with update mode ( '&amp;lt;tt&amp;gt;+&amp;lt;/tt&amp;gt;' as the second or third character in the mode argument), both input and output may be performed on the associated stream.&lt;br /&gt;
&lt;br /&gt;
Writing and appending modes will attempt to create a file of the given name, if no such file already exists. If this operation fails, &amp;lt;c&amp;gt;[[file]].open&amp;lt;/c&amp;gt; will return &amp;lt;c&amp;gt;[[null]]&amp;lt;/c&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
This appends a new line to an existing text file (creating it if it does not already exist).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;f = file.open(&amp;quot;test.txt&amp;quot;, &amp;quot;a&amp;quot;)&lt;br /&gt;
f.write char(13) + &amp;quot;Hello world!&amp;quot;&lt;br /&gt;
f.close&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>Redspark</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=File.open&amp;diff=1437</id>
		<title>File.open</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=File.open&amp;diff=1437"/>
		<updated>2025-09-29T15:04:34Z</updated>

		<summary type="html">&lt;p&gt;Redspark: Update file mode descriptions for clarification&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In [[Mini Micro]] and [[command-line MiniScript]], the &amp;lt;c&amp;gt;[[file]].open&amp;lt;/c&amp;gt; function returns a [[FileHandle]] object that enables further reads, writes, or updates of the file.&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 !! Default Value !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| path || &amp;quot;&amp;quot; || full or partial path to the file of interest&lt;br /&gt;
|-&lt;br /&gt;
| mode || &amp;quot;r+&amp;quot; || file mode (see below)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== File Modes ===&lt;br /&gt;
&lt;br /&gt;
The second parameter to &amp;lt;c&amp;gt;[[file]].open&amp;lt;/c&amp;gt; specifies whether the file is opened for reading, writing, or both.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Mode !! Description !! Starting Position&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;tt&amp;gt;r&amp;lt;/tt&amp;gt; || Opens an existing text file for reading. If the file does not exist, fopen() returns NULL. || beginning&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;tt&amp;gt;w&amp;lt;/tt&amp;gt; || Opens a text file for writing. If the file exists, its contents are truncated (emptied). If the file does not exist, a new file is created. || beginning&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;tt&amp;gt;a&amp;lt;/tt&amp;gt; || Opens a text file for appending. Data is written to the end of the file. If the file does not exist, a new file is created. || end&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;tt&amp;gt;r+&amp;lt;/tt&amp;gt; || Opens an existing text file for both reading and writing. The file must exist.|| beginning&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;tt&amp;gt;w+&amp;lt;/tt&amp;gt;  || Opens a text file for both writing and reading. If the file exists, its contents are truncated. If the file does not exist, a new file is created. || beginning&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;tt&amp;gt;a+&amp;lt;/tt&amp;gt; || Opens a text file for both appending and reading. Data is written to the end of the file. If the file does not exist, a new file is created. || end&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
When a file is opened with update mode ( '&amp;lt;tt&amp;gt;+&amp;lt;/tt&amp;gt;' as the second or third character in the mode argument), both input and output may be performed on the associated stream.&lt;br /&gt;
&lt;br /&gt;
Writing and appending modes will attempt to create a file of the given name, if no such file already exists. If this operation fails, &amp;lt;c&amp;gt;[[file]].open&amp;lt;/c&amp;gt; will return &amp;lt;c&amp;gt;[[null]]&amp;lt;/c&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
This appends a new line to an existing text file (creating it if it does not already exist).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;f = file.open(&amp;quot;test.txt&amp;quot;, &amp;quot;a&amp;quot;)&lt;br /&gt;
f.write char(13) + &amp;quot;Hello world!&amp;quot;&lt;br /&gt;
f.close&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>Redspark</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Events&amp;diff=1433</id>
		<title>Events</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Events&amp;diff=1433"/>
		<updated>2025-09-05T12:40:10Z</updated>

		<summary type="html">&lt;p&gt;Redspark: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This system module defines the EventSprite class which expands on the Sprite class to add definable event functions called handlers.  These handlers are triggered under certain conditions such as a mouse being clicked.  A special EventLoop is defined to act as a dedicated game loop that manages all of the event classes.  Since the EventLoop is continuous until terminated by an eventLoop.stop call, you would have to design your game around using this module by making all Sprites in your game EventSprites.&lt;br /&gt;
&lt;br /&gt;
== Classes ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| [[events.EventHandler|EventHandler]] || Stores information about the action to take when responding to an Event.&lt;br /&gt;
|-&lt;br /&gt;
| [[events.KeyHandler|KeyHandler]] || Stores the current state of a particular Key including whether it is Up, Down or being Held down.&lt;br /&gt;
|-&lt;br /&gt;
| [[events.EventSprite|EventSprite]] || Builds on the Sprite class to add event handlers that respond to events such as:  onKey, onKeyDown, onKeyUp, onClick, etc.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Event Loop ==&lt;br /&gt;
Within the module, there is a special singleton class call eventLoop which is meant to only exist once.  It governs the game loop and manages the responses to the triggered events.  This is a dedicated game loop which will continue to execute until an event terminates the loop or program in some way.&lt;br /&gt;
&lt;br /&gt;
=== Methods ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| run || The main game loop. Continues to execute until stop is called or the program is interrupted.&lt;br /&gt;
|-&lt;br /&gt;
| stop || Terminates the main loop on the next frame.&lt;br /&gt;
|-&lt;br /&gt;
| update || Called from the main loop each frame.  Responsible for maintaining state of all events.&lt;br /&gt;
|-&lt;br /&gt;
| doAfter || Schedules a function call to happen at a later physical time.&lt;br /&gt;
|-&lt;br /&gt;
| cancelDoAfter ||  Removes a previously scheduled call by doAfter.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&amp;lt;ms&amp;gt;&lt;br /&gt;
	import &amp;quot;events&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	clear&lt;br /&gt;
	display(4).mode = displayMode.sprite&lt;br /&gt;
	spr = new events.EventSprite&lt;br /&gt;
	spr.image = file.loadImage(&amp;quot;/sys/pics/Wumpus.png&amp;quot;)&lt;br /&gt;
	spr.onKey = new events.KeyHandler&lt;br /&gt;
	spr.onKey[&amp;quot;left&amp;quot;] = function&lt;br /&gt;
		self.x = self.x - 10&lt;br /&gt;
		if self.x &amp;lt; 50 then eventLoop.stop&lt;br /&gt;
	end function&lt;br /&gt;
	spr.onKey[&amp;quot;right&amp;quot;] = function&lt;br /&gt;
		self.x = self.x + 10&lt;br /&gt;
	end function&lt;br /&gt;
	events.eventLoop.onKey[&amp;quot;escape&amp;quot;] = function&lt;br /&gt;
		eventLoop.stop&lt;br /&gt;
	end function&lt;br /&gt;
	events.eventLoop.onKeyDown[&amp;quot;space&amp;quot;] = function; print &amp;quot;space down&amp;quot;; end function&lt;br /&gt;
	events.eventLoop.onKey[&amp;quot;space&amp;quot;] = function; print &amp;quot;space held&amp;quot;; end function&lt;br /&gt;
	events.eventLoop.onKeyUp[&amp;quot;space&amp;quot;] = function; print &amp;quot;space up&amp;quot;; end function&lt;br /&gt;
	&lt;br /&gt;
	spr.onClick = function&lt;br /&gt;
		self.scale = 1.5&lt;br /&gt;
	end function&lt;br /&gt;
	spr.onDrag = function&lt;br /&gt;
		self.x = mouse.x&lt;br /&gt;
		self.y = mouse.y&lt;br /&gt;
	end function&lt;br /&gt;
	spr.onDragEnd = function&lt;br /&gt;
		self.scale = 1&lt;br /&gt;
	end function&lt;br /&gt;
	&lt;br /&gt;
	spr.x = 480&lt;br /&gt;
	spr.y = 320&lt;br /&gt;
	spr.start&lt;br /&gt;
	&lt;br /&gt;
	print &amp;quot;Click and drag, or press left/right.&amp;quot;&lt;br /&gt;
	print &amp;quot;All event-driven.  (Esc to exit.)&amp;quot;&lt;br /&gt;
	&lt;br /&gt;
	events.eventLoop.run&lt;br /&gt;
&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:Sys Modules]]&lt;/div&gt;</summary>
		<author><name>Redspark</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Map&amp;diff=1432</id>
		<title>Map</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Map&amp;diff=1432"/>
		<updated>2025-09-02T07:31:36Z</updated>

		<summary type="html">&lt;p&gt;Redspark: Adjusted Pop definition&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;c&amp;gt;map&amp;lt;/c&amp;gt; is one of the core [[:Category:Data Types|data types]] in MiniScript.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Method !! Description&lt;br /&gt;
|-&lt;br /&gt;
| hasIndex(''key'') || Returns true if the map contains ''key''&lt;br /&gt;
|-&lt;br /&gt;
| indexes || Returns a list of the map keys&lt;br /&gt;
|-&lt;br /&gt;
| indexOf(''value'', ''after'') || Returns the key of the first occurrence of ''value'' in the map, or &amp;lt;c&amp;gt;null&amp;lt;/c&amp;gt; if not found. Does not search inheritance chain.&lt;br /&gt;
|-&lt;br /&gt;
| len || Returns the number of key/value pairs contained in the map&lt;br /&gt;
|-&lt;br /&gt;
| pop || Removes a key/value pair from the map and returns the key.  There is no guarantee which pair gets removed.&lt;br /&gt;
|-&lt;br /&gt;
| push ''key'' || Adds the ''key'' to the map and assigns a value of 1&lt;br /&gt;
|-&lt;br /&gt;
| pull || Same as pop.&lt;br /&gt;
|-&lt;br /&gt;
| shuffle || Mutates the map by randomly re-ordering the values assigned to each key within the map&lt;br /&gt;
|-&lt;br /&gt;
| sum || Returns the sum of all numeric values in the map&lt;br /&gt;
|-&lt;br /&gt;
| remove ''key'' || Removes the key/value pair at ''key''&lt;br /&gt;
|-&lt;br /&gt;
| replace ''oldValue'', ''newValue'', ''maxCount'' || Mutates the map by replacing occurrences of ''oldValue'' with ''newValue'' at most ''maxCount'', if specified. If ''maxCount'' is omitted it replaces '''all''' occurrences.&lt;br /&gt;
|-&lt;br /&gt;
| values || Returns a list values within the map&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[mapUtil]] - for additional functions on a list&lt;br /&gt;
&lt;br /&gt;
[[Category:Language]]&lt;br /&gt;
[[Category:Data Types]]&lt;/div&gt;</summary>
		<author><name>Redspark</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Map&amp;diff=1431</id>
		<title>Map</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Map&amp;diff=1431"/>
		<updated>2025-09-02T00:55:28Z</updated>

		<summary type="html">&lt;p&gt;Redspark: Added base methods for the map class&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;c&amp;gt;map&amp;lt;/c&amp;gt; is one of the core [[:Category:Data Types|data types]] in MiniScript.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Method !! Description&lt;br /&gt;
|-&lt;br /&gt;
| hasIndex(''key'') || Returns true if the map contains ''key''&lt;br /&gt;
|-&lt;br /&gt;
| indexes || Returns a list of the map keys&lt;br /&gt;
|-&lt;br /&gt;
| indexOf(''value'', ''after'') || Returns the key of the first occurrence of ''value'' in the map, or &amp;lt;c&amp;gt;null&amp;lt;/c&amp;gt; if not found. Does not search inheritance chain.&lt;br /&gt;
|-&lt;br /&gt;
| len || Returns the number of key/value pairs contained in the map&lt;br /&gt;
|-&lt;br /&gt;
| pop || Removes the most recently added key/value pair and returns the key&lt;br /&gt;
|-&lt;br /&gt;
| push ''key'' || Adds the ''key'' to the map and assigns a value of 1&lt;br /&gt;
|-&lt;br /&gt;
| pull || Same as pop.&lt;br /&gt;
|-&lt;br /&gt;
| shuffle || Mutates the map by randomly re-ordering the values assigned to each key within the map&lt;br /&gt;
|-&lt;br /&gt;
| sum || Returns the sum of all numeric values in the map&lt;br /&gt;
|-&lt;br /&gt;
| remove ''key'' || Removes the key/value pair at ''key''&lt;br /&gt;
|-&lt;br /&gt;
| replace ''oldValue'', ''newValue'', ''maxCount'' || Mutates the map by replacing occurrences of ''oldValue'' with ''newValue'' at most ''maxCount'', if specified. If ''maxCount'' is omitted it replaces '''all''' occurrences.&lt;br /&gt;
|-&lt;br /&gt;
| values || Returns a list values within the map&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[mapUtil]] - for additional functions on a list&lt;br /&gt;
&lt;br /&gt;
[[Category:Language]]&lt;br /&gt;
[[Category:Data Types]]&lt;/div&gt;</summary>
		<author><name>Redspark</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Bibliography&amp;diff=1430</id>
		<title>Bibliography</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Bibliography&amp;diff=1430"/>
		<updated>2025-08-30T01:39:36Z</updated>

		<summary type="html">&lt;p&gt;Redspark: Added Joe's Dev.to articles until end of Aug 2025&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page lists published articles that include some nontrivial mention of MiniScript or Mini Micro.&lt;br /&gt;
&lt;br /&gt;
== Primary Sources ==&lt;br /&gt;
&lt;br /&gt;
Primary sources are those written by people directly involved.  Currently, that mostly means things written by [[User:JoeStrout|Joe Strout]].&lt;br /&gt;
&lt;br /&gt;
=== Books ===&lt;br /&gt;
&lt;br /&gt;
* Strout, J (2020). ''Learn to Code in 30 Days: with MiniScript and Mini Micro''.  MiniScript Press. ISBN 978-1-7361676-0-1.  (Also available as ebook: ISBN 978-1-7361676-2-5.)&lt;br /&gt;
&lt;br /&gt;
* Strout, J (2021). ''Introduction to Computer Programming: for kids of all ages''.  MiniScript Press.  ISBN 978-1-7361676-1-8.&lt;br /&gt;
&lt;br /&gt;
=== Articles &amp;amp; Conference Proceedings ===&lt;br /&gt;
&lt;br /&gt;
* Strout, J. &amp;quot;[https://ieeexplore.ieee.org/document/9625108 MiniScript: A new language for computer programming education.]&amp;quot; [http://istem-ed.com/istem-ed2021/ iSTEM-Ed] (2021). (preprint [https://miniscript.org/files/Strout_iSTEM-Ed2021.pdf PDF])&lt;br /&gt;
&lt;br /&gt;
* Strout, J. &amp;quot;[https://kidscodecs.com/mini-micro-coding-introduction/ Introducing Mini Micro]&amp;quot; [https://beanzmag.com/ Beanz Magazine] February 2022, p. 8-9.&lt;br /&gt;
&lt;br /&gt;
* Strout, J. &amp;quot;[https://kidscodecs.com/mini-micro-stars-experiment/ Experimental Coding]&amp;quot; [https://beanzmag.com/ Beanz Magazine] April 2022, p. 24-25.&lt;br /&gt;
&lt;br /&gt;
* Strout, J. &amp;quot;[https://kidscodecs.com/mini-micro-space-game-project/ An Apple a Day...]&amp;quot; [https://beanzmag.com/ Beanz Magazine] June 2022, p. 13.&lt;br /&gt;
&lt;br /&gt;
* Strout, J. &amp;quot;[https://kidscodecs.com/mini-micro-clock-timer/ Make a Clock Timer]&amp;quot; [https://beanzmag.com/ Beanz Magazine] August 2022, p. 13.&lt;br /&gt;
&lt;br /&gt;
* Strout, J. &amp;quot;[https://kidscodecs.com/mini-micro-secret-message-rot13/ Loopy Secret Messages] [https://beanzmag.com/ Beanz Magazine] October 2022, p. 12-13.&lt;br /&gt;
&lt;br /&gt;
* Strout, J. &amp;quot;[https://kidscodecs.com/farmtronics/ Auto-Code in Stardew Valley]&amp;quot; [https://beanzmag.com/ Beanz Magazine] December 2022, p. 4-5.&lt;br /&gt;
&lt;br /&gt;
* Strout, J. &amp;quot;[https://kidscodecs.com/farmtronics-gardening-howto/ A Bot “Outstanding in its Field”]&amp;quot; [https://beanzmag.com/ Beanz Magazine] February 2023&lt;br /&gt;
&lt;br /&gt;
* Strout, J. &amp;quot;[https://kidscodecs.com/farmtronics-finding-your-way/ Finding Your Way]&amp;quot; [https://beanzmag.com/ Beanz Magazine] April 2023&lt;br /&gt;
&lt;br /&gt;
* Strout, J. &amp;quot;[https://kidscodecs.com/minimicro-project-find-objects/ Explore Mars like a Rover]&amp;quot; [https://beanzmag.com/ Beanz Magazine] June 2023&lt;br /&gt;
&lt;br /&gt;
=== Blog Posts ===&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Why MiniScript?&amp;quot; Luminary Apps, 06 Sep. 2019, https://luminaryapps.com/blog/miniscript-why/.  Accessed 5 Dec. 2021.&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;VT100 Escape Codes in Command-Line MiniScript&amp;quot; Luminary Apps, 03 Oct. 2021, https://luminaryapps.com/blog/vt100-codes/index.html.  Accessed 13 Jul. 2022.&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Debugging with a Validate Method&amp;quot; Luminary Apps, 01 Nov. 2021, https://luminaryapps.com/blog/validate/index.html.  Accessed 13 Jul. 2022.&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;String Fill and Match&amp;quot; Luminary Apps, 10 Jun. 2022, https://luminaryapps.com/blog/ms-fill-match/index.html.  Accessed 13 Jul. 2022.&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Advanced Tricks with Import&amp;quot; Luminary Apps, 16 Jun. 2022, https://luminaryapps.com/blog/advanced-import/index.html.  Accessed 13 Jul. 2022.&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Use GPT-3 in Mini Micro&amp;quot; Dev.to, 21 Dec. 2022, https://dev.to/joestrout/use-gpt-3-in-mini-micro-1h63.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Advent of Code 2022 Wrap-Up&amp;quot; Dev.to, 13 Jan. 2023, https://dev.to/joestrout/advent-of-code-2022-wrap-up-2402.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Image Artsification in Mini Micro&amp;quot; Dev.to, 15 Jan. 2023, https://dev.to/joestrout/image-artsification-in-mini-micro-3fh0.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Make a `rerun` command for Mini Micro&amp;quot; Dev.to, 21 Jan. 2023, https://dev.to/joestrout/make-a-rerun-command-for-mini-micro-30h1.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;MiniScript 1.6 Now Available&amp;quot; Dev.to, 6 Feb. 2023, https://dev.to/joestrout/miniscript-16-now-available-fc7.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;What's New in Command-Line MiniScript v1.2&amp;quot; Dev.to, 9 Feb. 2023, https://dev.to/joestrout/whats-new-in-command-line-miniscript-v12-4ce9.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;MiniScript v1.6.1&amp;quot; Dev.to, 1 Jul. 2023, https://dev.to/joestrout/miniscript-v161-jka.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Customizing the Mini Micro code editor&amp;quot; Dev.to, 5 Jul. 2023, https://dev.to/joestrout/customizing-the-mini-micro-code-editor-6ji.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Converting 100 Classic BASIC Games to MiniScript&amp;quot; Dev.to, 25 Aug. 2023, https://dev.to/joestrout/converting-100-classic-basic-games-to-miniscript-4p3g.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;100 BASIC Computer Games, Ported to MiniScript&amp;quot; Dev.to, 24 Oct. 2023, https://dev.to/joestrout/100-basic-computer-games-ported-to-miniscript-3oj3.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;&amp;quot;MiniScript Mentor&amp;quot; GPT&amp;quot; Dev.to, 13 Nov. 2023, https://dev.to/joestrout/miniscript-mentor-gpt-9ig.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Join the MiniScript &amp;quot;Advent of Code&amp;quot; contest!&amp;quot; Dev.to, 29 Nov. 2023, https://dev.to/joestrout/join-the-miniscript-advent-of-code-contest-3gm5.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Using textures from /sys/pics/textures&amp;quot; Dev.to, 24 Jan. 2024, https://dev.to/joestrout/using-textures-from-syspicstextures-478m.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Demo Highlight: Asteroids&amp;quot; Dev.to, 31 Jan. 2024, https://dev.to/joestrout/demo-highlight-asteroids-250d.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;MiniScript Ports&amp;quot; Dev.to, 7 Feb. 2024, https://dev.to/joestrout/miniscript-ports-jp9.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Announcing Command-Line MiniScript 1.3 (with `exec`!)&amp;quot; Dev.to, 19 Feb. 2024, https://dev.to/joestrout/announcing-command-line-miniscript-13-with-exec-477b.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;MiniScript on a bare-metal Raspberry Pi&amp;quot; Dev.to, 2 Mar. 2024, https://dev.to/joestrout/miniscript-on-a-bare-metal-raspberry-pi-59p6.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Off-screen displays in Mini Micro&amp;quot; Dev.to, 6 Mar. 2024, https://dev.to/joestrout/off-screen-displays-in-mini-micro-41mb.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Announcing Mini Micro 1.2.1&amp;quot; Dev.to, 3 Apr. 2024, https://dev.to/joestrout/announcing-mini-micro-121-5e3n.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;MiniScript and Micro Jam Join Forces for Mega Fun&amp;quot; Dev.to, 10 Apr. 2024, https://dev.to/joestrout/miniscript-and-micro-jam-join-forces-for-mega-fun-2b9c.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Text entry tricks in Mini Micro&amp;quot; Dev.to, 17 Apr. 2024, https://dev.to/joestrout/text-entry-tricks-in-mini-micro-1p65.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;The making of Kip and the Caves of Lava&amp;quot; Dev.to, 8 May 2024, https://dev.to/joestrout/the-making-of-kip-and-the-caves-of-lava-mk3.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Demo highlight: cardFlip&amp;quot; Dev.to, 19 May 2024, https://dev.to/joestrout/demo-highlight-cardflip-26o1.  Accessed 19 May 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe. &amp;quot;Version Checking in MiniScript&amp;quot; Dev.to, 20 Jun 2024, https://dev.to/joestrout/version-checking-in-miniscript-gob.  Accessed 20 Jun 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe.  &amp;quot;Make a digital clock in Mini Micro&amp;quot; Dev.to, 03 Jul 2024, https://dev.to/joestrout/make-a-digital-clock-in-mini-micro-3mpl.  Accessed 03 Jul 2024&lt;br /&gt;
&lt;br /&gt;
* Strout, Joe.  &amp;quot;The Making of Solitaire for Mini Micro&amp;quot;, Dev.to, 10 Jul 2024, https://dev.to/joestrout/the-making-of-solitaire-for-mini-micro-19hf. Accessed 10 Jul 2024&lt;br /&gt;
* Strout, Joe.  &amp;quot;if locals == globals&amp;quot;, Dev.to, 24 Jul 2024, https://dev.to/joestrout/if-locals-globals-38bh. Accessed 24 Jul 2024&lt;br /&gt;
* Strout, Joe.  &amp;quot;Creating a Level Editor for Sub-Optimal&amp;quot;, Dev.to, 18 Aug 2024, https://dev.to/joestrout/creating-a-level-editor-for-sub-optimal-19hd. Accessed 18 Aug 2024&lt;br /&gt;
* Strout, Joe.  &amp;quot;Best New Mini Micro Games&amp;quot;, Dev.to, 27 Aug 2024, https://dev.to/joestrout/best-new-mini-micro-games-55gg. Accessed 27 Aug 2024&lt;br /&gt;
* Strout, Joe.  &amp;quot;Oldest surviving sprite award: Ghost-tiny&amp;quot;, Dev.to, 18 Sep 2024, https://dev.to/joestrout/oldest-surviving-sprite-award-ghost-tiny-2dba. Accessed 18 Sep 2024&lt;br /&gt;
* Strout, Joe.  &amp;quot;Mini Micro has an &amp;quot;attract mode&amp;quot;!&amp;quot;, Dev.to, 09 Oct 2024, https://dev.to/joestrout/mini-micro-has-an-attract-mode-i7j. Accessed 09 Oct 2024&lt;br /&gt;
* Strout, Joe.  &amp;quot;Daily MiniScript mini-challenges&amp;quot;, Dev.to, 16 Oct 2024, https://dev.to/joestrout/daily-miniscript-mini-challenges-3732. Accessed 16 Oct 2024&lt;br /&gt;
* Strout, Joe.  &amp;quot;How displays work in Mini Micro&amp;quot;, Dev.to, 24 Nov 2024, https://dev.to/joestrout/how-displays-work-in-mini-micro-21pp. Accessed 24 Nov 2024&lt;br /&gt;
* Strout, Joe.  &amp;quot;MiniScript: Why &amp;quot;f = function&amp;quot;?&amp;quot;, Dev.to, 26 Jan 2025, https://dev.to/joestrout/miniscript-why-f-function-fcp. Accessed 26 Jan 2025&lt;br /&gt;
* Strout, Joe.  &amp;quot;Why Mini Micro's Screen is 960x640&amp;quot;, Dev.to, 5 Feb 2025, https://dev.to/joestrout/why-mini-micros-screen-is-960x640-16d5. Accessed 5 Feb 2025&lt;br /&gt;
* Strout, Joe.  &amp;quot;Optimizing Mini Micro for pixel-art games&amp;quot;, Dev.to, 19 Feb 2025, https://dev.to/joestrout/optimizing-mini-micro-for-pixel-art-games-3mdf. Accessed 19 Feb 2025&lt;br /&gt;
* Strout, Joe.  &amp;quot;Mini Micro speaks like a droid!&amp;quot;, Dev.to, 28 Feb 2025, https://dev.to/joestrout/mini-micro-speaks-like-a-droid-2hdl. Accessed 28 Feb 2025&lt;br /&gt;
* Strout, Joe.  &amp;quot;Announcing Mini Micro 1.2.4&amp;quot;, Dev.to, 8 Mar 2025, https://dev.to/joestrout/announcing-mini-micro-124-28l1. Accessed 8 Mar 2025&lt;br /&gt;
* Strout, Joe.  &amp;quot;Other MiniScript Bloggers to Follow&amp;quot;, Dev.to, 14 Mar 2025, https://dev.to/joestrout/other-miniscript-bloggers-to-follow-19lf. Accessed 14 Mar 2025&lt;br /&gt;
* Strout, Joe.  &amp;quot;Hexes and bricks in Mini Micro&amp;quot;, Dev.to, 30 Mar 2025, https://dev.to/joestrout/hexes-and-bricks-in-mini-micro-e99. Accessed 30 Mar 2025&lt;br /&gt;
* Strout, Joe.  &amp;quot;Taming local git branches&amp;quot;, Dev.to, 7 Apr 2025, https://dev.to/joestrout/taming-local-git-branches-4nd9. Accessed 7 Apr 2025&lt;br /&gt;
* Strout, Joe.  &amp;quot;Don't Abuse Lerp!&amp;quot;, Dev.to, 11 Apr 2025, https://dev.to/joestrout/dont-abuse-lerp-4k6d. Accessed 11 Apr 2025&lt;br /&gt;
* Strout, Joe.  &amp;quot;Fathom's Edge: Progress Report #1&amp;quot;, Dev.to, 8 May 2025, https://dev.to/joestrout/fathoms-edge-progress-report-1-2llb. Accessed 8 May 2025&lt;br /&gt;
* Strout, Joe.  &amp;quot;Proper setup for a MiniScript GitHub repo&amp;quot;, Dev.to, 27 May 2025, https://dev.to/joestrout/proper-setup-for-a-miniscript-github-repo-4ian. Accessed 27 May 2025&lt;br /&gt;
* Strout, Joe.  &amp;quot;Apple ][ Text on Mini Micro!&amp;quot;, Dev.to, 02 Aug 2025, https://dev.to/joestrout/apple-text-on-mini-micro-337. Accessed 02 Aug, 2025&lt;br /&gt;
* Strout, Joe.  &amp;quot;UV Mapping in Mini Micro&amp;quot;, Dev.to, 05 Aug 2025, https://dev.to/joestrout/uv-mapping-in-mini-micro-2eoa. Accessed 05 Aug, 2025&lt;br /&gt;
&lt;br /&gt;
== Tutorials ==&lt;br /&gt;
&lt;br /&gt;
* &amp;quot;Learn X in Y Minutes: MiniScript&amp;quot;: https://learnxinyminutes.com/docs/miniscript/.  Access 20 Jun 2024&lt;br /&gt;
&lt;br /&gt;
== Secondary Sources ==&lt;br /&gt;
&lt;br /&gt;
Secondary sources are those written by people not directly involved in the work.&lt;br /&gt;
&lt;br /&gt;
=== Magazine/Journal Articles ===&lt;br /&gt;
&lt;br /&gt;
* Slavin, Tom. &amp;quot;Make a Mini Micro Collection Game.&amp;quot;  ''Beanz'' Vol. 11, No. 3, Dec 2023. Also available online at https://kidscodecs.com/mini-micro-space-game/ (accessed 12 Dec 2023).&lt;br /&gt;
&lt;br /&gt;
=== Blog Posts ===&lt;br /&gt;
&lt;br /&gt;
* Nozzi, Sebastian. “Neo-Retro Computing.” Dev.to, 20 Nov. 2021, https://dev.to/sebnozzi/about-mini-micro-short-1g0e. Accessed 5 Dec. 2021.&lt;br /&gt;
&lt;br /&gt;
* TopaAzul062. &amp;quot;Review of Learn to Code in 30 Days.&amp;quot; OnlineBookClub.org, 21 Oct. 2021, https://forums.onlinebookclub.org/viewtopic.php?f=24&amp;amp;t=205860.  Accessed 5 Dec. 2021.&lt;br /&gt;
&lt;br /&gt;
* Khorne. &amp;quot;Where to begin, where to start?&amp;quot; Khornes MiniScript Journey, 2 Mar. 2022, https://khornemsjourney.blogspot.com/2023/07/where-to-begin-where-to-start.html.  Accessed 2 Aug. 2023.  (Originally located [https://khornems.blogspot.com/2022/03/where-to-begin-where-to-start.html here].)&lt;br /&gt;
&lt;br /&gt;
* Nozzi, Sebastian. &amp;quot;Counting 5-letter words&amp;quot; Dev.to, 25 Oct.2022, https://dev.to/sebnozzi/counting-5-letter-words-2cdo.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Nozzi, Sebastian. &amp;quot;Most common word length&amp;quot; Dev.to, 26 Oct. 2022, https://dev.to/sebnozzi/most-common-word-length-e7e.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Nozzi, Sebastian. &amp;quot;Counting word lengths (map approach)&amp;quot; Dev.to, 26 Oct. 2022, https://dev.to/sebnozzi/counting-word-lengths-map-approach-43p1.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Kratt, Max. &amp;quot;Launch in Mini Micro&amp;quot;. Max Kratt's blog, 19 Jan. 2023, https://maxkratt.hashnode.dev/launch-in-mini-micro&lt;br /&gt;
&lt;br /&gt;
* Tomes, Trey. “Fluent Interfaces.”  Micro-Hack wiki, 30 Mar. 2023, https://github.com/treytomes/micro-hack/wiki/Fluent-Interfaces&lt;br /&gt;
&lt;br /&gt;
* Quinn. &amp;quot;Unleashing Creativity with Mini Micro: Code Games and More with MiniScript&amp;quot; Dev.to, 4 Aug. 2023, https://dev.to/midsubspace/unleashing-creativity-with-mini-micro-code-games-and-more-with-miniscript-2djm.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Quinn. &amp;quot;Getting Started with Farmtronics&amp;quot; Quinn's Blog, 12 Aug. 2023, https://midsubspace.hashnode.dev/getting-started-with-farmtronics&lt;br /&gt;
&lt;br /&gt;
* Lefebvre, Paul.  &amp;quot;Mini Micro and MiniScript: A Great Retro Programming Combination.&amp;quot;  Goto 10 RetroComputing, 22 Sep. 2023, https://www.goto10retro.com/p/mini-micro-and-miniscript-a-great.  Accessed 22 Sep. 2023.&lt;br /&gt;
&lt;br /&gt;
* Hansen, Russell.  &amp;quot;MiniScript Roundup #1&amp;quot; Dev.to, 8 Oct. 2023, https://dev.to/synapticbytes/miniscript-roundup-1-a7n.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Hansen, Russell. &amp;quot;Designing the MiniScript to Godot Framework&amp;quot; Dev.to, 9 Oct. 2023, https://dev.to/synapticbytes/designing-the-miniscript-to-godot-framework-3jm1.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Hansen, Russell. &amp;quot;MiniScript in Godot Progress Report #1&amp;quot; Dev.to, 13 Oct. 2023, https://dev.to/synapticbytes/minscript-in-godot-progress-report-1-5bg1.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Nozzi, Sebastian. &amp;quot;Coin Collector Game&amp;quot; Dev.to, 4 May 2024, https://dev.to/sebnozzi/coin-collector-1lh6.  Accessed 12 May 2024&lt;br /&gt;
&lt;br /&gt;
* Selfish Dev. &amp;quot;Why Miniscript&amp;quot; Dev.to, 27 Feb. 2025, https://dev.to/selfish_dev/why-miniscript-13fi.  Accessed 9 Apr. 2025.&lt;br /&gt;
&lt;br /&gt;
* Selfish Dev. &amp;quot;How to render a sprite in Mini Micro&amp;quot; Dev.to, 4 Mar. 2025, https://dev.to/selfish_dev/how-to-render-a-sprite-in-mini-micro-h03.  Accessed 9 Apr. 2025.&lt;br /&gt;
&lt;br /&gt;
* Selfish Dev. &amp;quot;How to register sprite clicks in mini micro&amp;quot; Dev.to, 8 Mar. 2025, https://dev.to/selfish_dev/how-to-register-sprite-clicks-in-mini-micro-2j42.  Accessed 9 Apr. 2025.&lt;br /&gt;
&lt;br /&gt;
* Selfish Dev. &amp;quot;Bounds In Mini Micro&amp;quot; Dev.to, 7 Mar. 2025, https://dev.to/selfish_dev/bounds-in-mini-micro-3pl1.  Accessed 9 Apr. 2025.&lt;br /&gt;
&lt;br /&gt;
* Selfish Dev. &amp;quot;WTF Mini Micro!&amp;quot; Dev.to, 13 Mar. 2025, https://dev.to/selfish_dev/wtf-mini-micro-6j5.  Accessed 9 Apr. 2025.&lt;br /&gt;
&lt;br /&gt;
* Selfish Dev. &amp;quot;Mini-Micro : Physics , Fixes and WTF&amp;quot; Dev.to, 15 Mar. 2025, https://dev.to/selfish_dev/mini-micro-physics-fixes-and-wtf-3gc4.  Accessed 9 Apr. 2025.&lt;br /&gt;
&lt;br /&gt;
* Selfish Dev. &amp;quot;How to load a sprite from web&amp;quot; Dev.to, 28 Mar. 2025, https://dev.to/selfish_dev/how-to-load-a-sprite-from-web-1kcp.  Accessed 9 Apr. 2025.&lt;br /&gt;
&lt;br /&gt;
* BibleClinger.  &amp;quot;Mini Micro and the 6502: Adding retro to the neo-retro&amp;quot; Dev.to, 12 Mar. 2025, https://dev.to/bibleclinger/mini-micro-and-the-6502-adding-retro-to-the-neo-retro-3mgh.  Accessed 9 Apr. 2025.&lt;br /&gt;
&lt;br /&gt;
* BibleClinger.  &amp;quot;Mini Micro and the 6502: Adding Keyboard Input&amp;quot; Dev.to, 16 Mar. 2025, https://dev.to/bibleclinger/mini-micro-and-the-6502-adding-keyboard-input-1cjm.  Accessed 9 Apr. 2025.&lt;br /&gt;
&lt;br /&gt;
* BibleClinger.  &amp;quot;Does MiniScript Need Variadic Functions?&amp;quot; Dev.to, 13 Mar. 2025, https://dev.to/bibleclinger/does-miniscript-need-variadic-functions-53a0.  Accessed 9 Apr. 2025.&lt;br /&gt;
&lt;br /&gt;
* BibleClinger.  &amp;quot;MiniScript's Parent-Class Variable Pitfall&amp;quot; Dev.to, 14 Mar. 2025, https://dev.to/bibleclinger/miniscripts-parent-class-variable-pitfall-4koi.  Accessed 9 Apr. 2025.&lt;br /&gt;
&lt;br /&gt;
* BibleClinger.  &amp;quot;MiniScript's locals, outer, and globals&amp;quot; Dev.to, 6 Apr. 2025, https://dev.to/bibleclinger/miniscripts-locals-outer-and-globals-1pcn.  Accessed 9 Apr. 2025.&lt;br /&gt;
&lt;br /&gt;
* Kinggd. &amp;quot;How I Made Drag-and-Drop Physics in Mini Micro&amp;quot; https://medium.com/@kinggd2424, 9 Apr. 2025,&lt;br /&gt;
&lt;br /&gt;
=== Pro Journalism ===&lt;br /&gt;
&lt;br /&gt;
* Stanton, Rich.  &amp;quot;Stardew Valley mod adds farming bots.&amp;quot; PC Gamer, 01 Jan. 2022, https://www.pcgamer.com/stardew-valley-mod-adds-farming-bots/&lt;br /&gt;
&lt;br /&gt;
[[Category:Community]]&lt;/div&gt;</summary>
		<author><name>Redspark</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Object-oriented_programming&amp;diff=1419</id>
		<title>Object-oriented programming</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Object-oriented_programming&amp;diff=1419"/>
		<updated>2025-06-08T21:37:46Z</updated>

		<summary type="html">&lt;p&gt;Redspark: Changed create to Create&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Object-oriented programming (OOP) is a way of organizing code and data using objects, which are essentially self-contained units of data and methods that operate on that data. OOP is a fundamental approach to software development in many languages like Java, C++, and Python.&lt;br /&gt;
&lt;br /&gt;
OOP relies on certain key concepts:&lt;br /&gt;
* '''Classes and Objects''': A class is a blueprint for creating objects, which are instances of that class. &lt;br /&gt;
* '''Encapsulation''': Bundling data (fields) and methods (procedures) that operate on that data within a single unit (object). &lt;br /&gt;
* '''Inheritance''': Creating new classes (subclasses) based on existing classes (superclasses), inheriting their attributes and behaviors. &lt;br /&gt;
* '''Polymorphism''': Allowing objects of different classes to be treated as objects of a common superclass, enabling code reuse and flexibility. &lt;br /&gt;
&lt;br /&gt;
== Classes and Objects ==&lt;br /&gt;
In their most straightforward form, classes act as blueprints for objects.  It's like a how you can drive into a rural area of a city and find many new homes with the same design.  The developers used one set of architectural blueprints to build all of those houses.  In the same way, one class can be used to construct many objects.&lt;br /&gt;
&lt;br /&gt;
An object, on the other hand, is an actual active instance of a built class in memory. In most languages, there is a keyword that tells the compiler to create an object from a class such as &amp;lt;c&amp;gt;[[new]]&amp;lt;/c&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Classes are mostly defined by their fields and methods.  Fields are just like variables except they are tied to a class or object.  Methods are similar to functions and they always have access to the fields within their class definition as if they those fields were passed as a parameter to the method.  Sometimes a language will require the keyword prefix &amp;lt;c&amp;gt;[[self]]&amp;lt;/c&amp;gt; when referencing a field or method within the class definition.&lt;br /&gt;
&lt;br /&gt;
In C++, let's define an Animal class:&lt;br /&gt;
&lt;br /&gt;
 class Animal {&lt;br /&gt;
  protected:&lt;br /&gt;
    std::string name;&lt;br /&gt;
    int age;&lt;br /&gt;
  public:&lt;br /&gt;
    Animal(const std::string&amp;amp; name, int age)&lt;br /&gt;
        : name(name), age(age) {}&lt;br /&gt;
    virtual ~Animal() {}&lt;br /&gt;
    virtual void speak() const = 0; // Pure virtual function&lt;br /&gt;
    virtual void info() const {&lt;br /&gt;
        std::cout &amp;lt;&amp;lt; &amp;quot;Name: &amp;quot; &amp;lt;&amp;lt; name &amp;lt;&amp;lt; &amp;quot;, Age: &amp;quot; &amp;lt;&amp;lt; age &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In MiniScript, the same class would be defined as:&lt;br /&gt;
&amp;lt;ms&amp;gt;&lt;br /&gt;
 Animal = { name:&amp;quot;&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
 Animal.Create = function(name, age)&lt;br /&gt;
   a = new Animal&lt;br /&gt;
   a.name = name&lt;br /&gt;
   a.age = age&lt;br /&gt;
   return a&lt;br /&gt;
 end function&lt;br /&gt;
&lt;br /&gt;
 Animal.speak = function&lt;br /&gt;
 end function&lt;br /&gt;
&lt;br /&gt;
 Animal.info = function&lt;br /&gt;
   print &amp;quot;Name: &amp;quot; + self.name + &amp;quot;, Age: &amp;quot; + self.age&lt;br /&gt;
 end function&lt;br /&gt;
&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Encapsulation ==&lt;br /&gt;
Encapsulation is more of a design technique to OOP programming and less of a technical aspect of any OOP language.  When you code using this technique, it allows the programmer to organize their project by grouping all behaviour and related data into classes.  When instantiated as an Object, this single container can be passed around in your code to &amp;quot;interact&amp;quot; with other objects.&lt;br /&gt;
&lt;br /&gt;
When coding with encapsulation in mind, all behaviours (methods) and properties (fields) related to a class will be defined in that class.  Knowing where to draw the line to include or exclude behaviour and properties tends to make or break an OOP design.  Often it is better to define something using multiple classes rather than trying to make one monolithic class.  A good rule of thumb is to dedicate a class to a single thing.&lt;br /&gt;
&lt;br /&gt;
Looking back at our Animal class above, we can see that it has two fields (name and age) and essentially two methods (speak and info).  Looking at &amp;lt;c&amp;gt;info()&amp;lt;/c&amp;gt; we can see that it only uses &amp;lt;c&amp;gt;name&amp;lt;/c&amp;gt; and &amp;lt;c&amp;gt;age&amp;lt;/c&amp;gt;.  As mentioned, that is what is defined in the class and so those are the only variables it has access to.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; &amp;amp;#128218; The other two methods in C++ are the constructor and destructor.  In MiniScript, you are not required to have either of these.  However, creating a constructor may help to declutter your code and make it easier to read.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Inheritance ==&lt;br /&gt;
In the same way that humans inherit certain genetic traits from their parents, classes can inherit from a single parent classes (some languages support multiple inheritance as well).  When a class inherits from another, all of the declared fields and methods of the parent class are automatically given to the child class.  Only the inheritance has to be defined for this to work.  For instance, in our Animal class, let's create two new children called Dog and Cat.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 class Cat : public Animal {&lt;br /&gt;
 private:&lt;br /&gt;
    bool likesToClimb;&lt;br /&gt;
 public:&lt;br /&gt;
    Cat(const std::string&amp;amp; name, int age, bool likesToClimb)&lt;br /&gt;
        : Animal(name, age), likesToClimb(likesToClimb) {}&lt;br /&gt;
    void speak() const override {&lt;br /&gt;
        std::cout &amp;lt;&amp;lt; name &amp;lt;&amp;lt; &amp;quot; says: Meow!&amp;quot; &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
    }&lt;br /&gt;
    void info() const override {&lt;br /&gt;
        Animal::info();&lt;br /&gt;
        std::cout &amp;lt;&amp;lt; &amp;quot;Likes to climb: &amp;quot; &amp;lt;&amp;lt; (likesToClimb ? &amp;quot;Yes&amp;quot; : &amp;quot;No&amp;quot;) &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
 class Dog : public Animal {&lt;br /&gt;
 private:&lt;br /&gt;
    std::string favoriteToy;&lt;br /&gt;
 public:&lt;br /&gt;
    Dog(const std::string&amp;amp; name, int age, const std::string&amp;amp; favoriteToy)&lt;br /&gt;
        : Animal(name, age), favoriteToy(favoriteToy) {}&lt;br /&gt;
    void speak() const override {&lt;br /&gt;
        std::cout &amp;lt;&amp;lt; name &amp;lt;&amp;lt; &amp;quot; says: Woof!&amp;quot; &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
    }&lt;br /&gt;
    void info() const override {&lt;br /&gt;
        Animal::info();&lt;br /&gt;
        std::cout &amp;lt;&amp;lt; &amp;quot;Favorite toy: &amp;quot; &amp;lt;&amp;lt; favoriteToy &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
In MiniScript, these would be defined as:&lt;br /&gt;
&amp;lt;ms&amp;gt;&lt;br /&gt;
 Cat = new Animal&lt;br /&gt;
 Cat.likesToClimb = true&lt;br /&gt;
 Cat.Create = function(name, age, likesToClimb)&lt;br /&gt;
   c = new Cat&lt;br /&gt;
   c.name = name&lt;br /&gt;
   c.age = age&lt;br /&gt;
   c.likesToClimb = likesToClimb&lt;br /&gt;
   return c&lt;br /&gt;
 end function&lt;br /&gt;
&lt;br /&gt;
 Cat.speak = function&lt;br /&gt;
   print self.name + &amp;quot; says: Meow!&amp;quot;&lt;br /&gt;
 end function&lt;br /&gt;
&lt;br /&gt;
 Cat.info = function&lt;br /&gt;
   super&lt;br /&gt;
   print &amp;quot;Likes to Climb: &amp;quot; + self.likesToClimb &lt;br /&gt;
 end function&lt;br /&gt;
&lt;br /&gt;
 Dog = new Animal&lt;br /&gt;
 Dog.favouriteToy = &amp;quot;None&amp;quot;&lt;br /&gt;
 Dog.Create = function(name, age, favouriteToy)&lt;br /&gt;
   d = new Dog&lt;br /&gt;
   d.name = name&lt;br /&gt;
   d.age = age&lt;br /&gt;
   d.favouriteToy = self.favouriteToy&lt;br /&gt;
   return d&lt;br /&gt;
 end function&lt;br /&gt;
&lt;br /&gt;
 Dog.speak = function&lt;br /&gt;
   print self.name + &amp;quot; says: Woof!&amp;quot;&lt;br /&gt;
 end function&lt;br /&gt;
&lt;br /&gt;
 Dog.info = function&lt;br /&gt;
   super&lt;br /&gt;
   print &amp;quot;Favourite Toy: &amp;quot; + self.favouriteToy &lt;br /&gt;
 end function&lt;br /&gt;
&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
MiniScript supports prototype-based OOP through &amp;lt;c&amp;gt;[[new]]&amp;lt;/c&amp;gt;, &amp;lt;c&amp;gt;[[self]]&amp;lt;/c&amp;gt;,  &amp;lt;c&amp;gt;[[super]]&amp;lt;/c&amp;gt;, and &amp;lt;c&amp;gt;[[isa|__isa]]&amp;lt;/c&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Language]]&lt;/div&gt;</summary>
		<author><name>Redspark</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Object-oriented_programming&amp;diff=1417</id>
		<title>Object-oriented programming</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Object-oriented_programming&amp;diff=1417"/>
		<updated>2025-06-08T20:53:34Z</updated>

		<summary type="html">&lt;p&gt;Redspark: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Object-oriented programming (OOP) is a way of organizing code and data using objects, which are essentially self-contained units of data and methods that operate on that data. OOP is a fundamental approach to software development in many languages like Java, C++, and Python.&lt;br /&gt;
&lt;br /&gt;
OOP relies on certain key concepts:&lt;br /&gt;
* '''Classes and Objects''': A class is a blueprint for creating objects, which are instances of that class. &lt;br /&gt;
* '''Encapsulation''': Bundling data (fields) and methods (procedures) that operate on that data within a single unit (object). &lt;br /&gt;
* '''Inheritance''': Creating new classes (subclasses) based on existing classes (superclasses), inheriting their attributes and behaviors. &lt;br /&gt;
* '''Polymorphism''': Allowing objects of different classes to be treated as objects of a common superclass, enabling code reuse and flexibility. &lt;br /&gt;
&lt;br /&gt;
== Classes and Objects ==&lt;br /&gt;
In their most straightforward form, classes act as blueprints for objects.  It's like a how you can drive into a rural area of a city and find many new homes with the same design.  The developers used one set of architectural blueprints to build all of those houses.  In the same way, one class can be used to construct many objects.&lt;br /&gt;
&lt;br /&gt;
An object, on the other hand, is an actual active instance of a built class in memory. In most languages, there is a keyword that tells the compiler to create an object from a class such as &amp;lt;c&amp;gt;[[new]]&amp;lt;/c&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Classes are mostly defined by their fields and methods.  Fields are just like variables except they are tied to a class or object.  Methods are similar to functions and they always have access to the fields within their class definition as if they those fields were passed as a parameter to the method.  Sometimes a language will require the keyword prefix &amp;lt;c&amp;gt;[[self]]&amp;lt;/c&amp;gt; when referencing a field or method within the class definition.&lt;br /&gt;
&lt;br /&gt;
In C++, let's define an Animal class:&lt;br /&gt;
&lt;br /&gt;
 class Animal {&lt;br /&gt;
  protected:&lt;br /&gt;
    std::string name;&lt;br /&gt;
    int age;&lt;br /&gt;
  public:&lt;br /&gt;
    Animal(const std::string&amp;amp; name, int age)&lt;br /&gt;
        : name(name), age(age) {}&lt;br /&gt;
    virtual ~Animal() {}&lt;br /&gt;
    virtual void speak() const = 0; // Pure virtual function&lt;br /&gt;
    virtual void info() const {&lt;br /&gt;
        std::cout &amp;lt;&amp;lt; &amp;quot;Name: &amp;quot; &amp;lt;&amp;lt; name &amp;lt;&amp;lt; &amp;quot;, Age: &amp;quot; &amp;lt;&amp;lt; age &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In MiniScript, the same class would be defined as:&lt;br /&gt;
&amp;lt;ms&amp;gt;&lt;br /&gt;
 Animal = { name:&amp;quot;&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
 Animal.create = function(name, age)&lt;br /&gt;
   a = new Animal&lt;br /&gt;
   a.name = name&lt;br /&gt;
   a.age = age&lt;br /&gt;
   return a&lt;br /&gt;
 end function&lt;br /&gt;
&lt;br /&gt;
 Animal.speak = function&lt;br /&gt;
 end function&lt;br /&gt;
&lt;br /&gt;
 Animal.info = function&lt;br /&gt;
   print &amp;quot;Name: &amp;quot; + self.name + &amp;quot;, Age: &amp;quot; + self.age&lt;br /&gt;
 end function&lt;br /&gt;
&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Encapsulation ==&lt;br /&gt;
Encapsulation is more of a design technique to OOP programming and less of a technical aspect of any OOP language.  When you code using this technique, it allows the programmer to organize their project by grouping all behaviour and related data into classes.  When instantiated as an Object, this single container can be passed around in your code to &amp;quot;interact&amp;quot; with other objects.&lt;br /&gt;
&lt;br /&gt;
When coding with encapsulation in mind, all behaviours (methods) and properties (fields) related to a class will be defined in that class.  Knowing where to draw the line to include or exclude behaviour and properties tends to make or break an OOP design.  Often it is better to define something using multiple classes rather than trying to make one monolithic class.  A good rule of thumb is to dedicate a class to a single thing.&lt;br /&gt;
&lt;br /&gt;
Looking back at our Animal class above, we can see that it has two fields (name and age) and essentially two methods (speak and info).  Looking at &amp;lt;c&amp;gt;info()&amp;lt;/c&amp;gt; we can see that it only uses &amp;lt;c&amp;gt;name&amp;lt;/c&amp;gt; and &amp;lt;c&amp;gt;age&amp;lt;/c&amp;gt;.  As mentioned, that is what is defined in the class and so those are the only variables it has access to.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; &amp;amp;#128218; The other two methods in C++ are the constructor and destructor.  In MiniScript, you are not required to have either of these.  However, creating a constructor may help to declutter your code and make it easier to read.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Inheritance ==&lt;br /&gt;
In the same way that humans inherit certain genetic traits from their parents, classes can inherit from a single parent classes (some languages support multiple inheritance as well).  When a class inherits from another, all of the declared fields and methods of the parent class are automatically given to the child class.  Only the inheritance has to be defined for this to work.  For instance, in our Animal class, let's create two new children called Dog and Cat.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 class Cat : public Animal {&lt;br /&gt;
 private:&lt;br /&gt;
    bool likesToClimb;&lt;br /&gt;
 public:&lt;br /&gt;
    Cat(const std::string&amp;amp; name, int age, bool likesToClimb)&lt;br /&gt;
        : Animal(name, age), likesToClimb(likesToClimb) {}&lt;br /&gt;
    void speak() const override {&lt;br /&gt;
        std::cout &amp;lt;&amp;lt; name &amp;lt;&amp;lt; &amp;quot; says: Meow!&amp;quot; &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
    }&lt;br /&gt;
    void info() const override {&lt;br /&gt;
        Animal::info();&lt;br /&gt;
        std::cout &amp;lt;&amp;lt; &amp;quot;Likes to climb: &amp;quot; &amp;lt;&amp;lt; (likesToClimb ? &amp;quot;Yes&amp;quot; : &amp;quot;No&amp;quot;) &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
 class Dog : public Animal {&lt;br /&gt;
 private:&lt;br /&gt;
    std::string favoriteToy;&lt;br /&gt;
 public:&lt;br /&gt;
    Dog(const std::string&amp;amp; name, int age, const std::string&amp;amp; favoriteToy)&lt;br /&gt;
        : Animal(name, age), favoriteToy(favoriteToy) {}&lt;br /&gt;
    void speak() const override {&lt;br /&gt;
        std::cout &amp;lt;&amp;lt; name &amp;lt;&amp;lt; &amp;quot; says: Woof!&amp;quot; &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
    }&lt;br /&gt;
    void info() const override {&lt;br /&gt;
        Animal::info();&lt;br /&gt;
        std::cout &amp;lt;&amp;lt; &amp;quot;Favorite toy: &amp;quot; &amp;lt;&amp;lt; favoriteToy &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
In MiniScript, these would be defined as:&lt;br /&gt;
&amp;lt;ms&amp;gt;&lt;br /&gt;
 Cat = new Animal&lt;br /&gt;
 Cat.likesToClimb = true&lt;br /&gt;
 Cat.create = function(name, age, likesToClimb)&lt;br /&gt;
   c = new Cat&lt;br /&gt;
   c.name = name&lt;br /&gt;
   c.age = age&lt;br /&gt;
   c.likesToClimb = likesToClimb&lt;br /&gt;
   return c&lt;br /&gt;
 end function&lt;br /&gt;
&lt;br /&gt;
 Cat.speak = function&lt;br /&gt;
   print self.name + &amp;quot; says: Meow!&amp;quot;&lt;br /&gt;
 end function&lt;br /&gt;
&lt;br /&gt;
 Cat.info = function&lt;br /&gt;
   super&lt;br /&gt;
   print &amp;quot;Likes to Climb: &amp;quot; + self.likesToClimb &lt;br /&gt;
 end function&lt;br /&gt;
&lt;br /&gt;
 Dog = new Animal&lt;br /&gt;
 Dog.favouriteToy = &amp;quot;None&amp;quot;&lt;br /&gt;
 Dog.create = function(name, age, favouriteToy)&lt;br /&gt;
   d = new Dog&lt;br /&gt;
   d.name = name&lt;br /&gt;
   d.age = age&lt;br /&gt;
   d.favouriteToy = self.favouriteToy&lt;br /&gt;
   return d&lt;br /&gt;
 end function&lt;br /&gt;
&lt;br /&gt;
 Dog.speak = function&lt;br /&gt;
   print self.name + &amp;quot; says: Meow!&amp;quot;&lt;br /&gt;
 end function&lt;br /&gt;
&lt;br /&gt;
 Dog.info = function&lt;br /&gt;
   super&lt;br /&gt;
   print &amp;quot;Favourite Toy: &amp;quot; + self.favouriteToy &lt;br /&gt;
 end function&lt;br /&gt;
&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
MiniScript supports prototype-based OOP through &amp;lt;c&amp;gt;[[new]]&amp;lt;/c&amp;gt;, &amp;lt;c&amp;gt;[[self]]&amp;lt;/c&amp;gt;,  &amp;lt;c&amp;gt;[[super]]&amp;lt;/c&amp;gt;, and &amp;lt;c&amp;gt;[[isa|__isa]]&amp;lt;/c&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Language]]&lt;/div&gt;</summary>
		<author><name>Redspark</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Object-oriented_programming&amp;diff=1416</id>
		<title>Object-oriented programming</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Object-oriented_programming&amp;diff=1416"/>
		<updated>2025-06-05T20:42:22Z</updated>

		<summary type="html">&lt;p&gt;Redspark: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Object-oriented programming (OOP) is a way of organizing code and data using objects, which are essentially self-contained units of data and methods that operate on that data. OOP is a fundamental approach to software development in many languages like Java, C++, and Python.&lt;br /&gt;
&lt;br /&gt;
OOP relies on certain key concepts:&lt;br /&gt;
* '''Classes and Objects''': A class is a blueprint for creating objects, which are instances of that class. &lt;br /&gt;
* '''Encapsulation''': Bundling data (fields) and methods (procedures) that operate on that data within a single unit (object). &lt;br /&gt;
* '''Inheritance''': Creating new classes (subclasses) based on existing classes (superclasses), inheriting their attributes and behaviors. &lt;br /&gt;
* '''Polymorphism''': Allowing objects of different classes to be treated as objects of a common superclass, enabling code reuse and flexibility. &lt;br /&gt;
&lt;br /&gt;
== Classes and Objects ==&lt;br /&gt;
In their most straightforward form, classes act as blueprints for objects.  It's like a how you can drive into a rural area of a city and find many new homes with the same design.  The developers used one set of architectural blueprints to build all of those houses.  In the same way, one class can be used to construct many objects.&lt;br /&gt;
&lt;br /&gt;
An object, on the other hand, is an actual active instance of a built class in memory. In most languages, there is a keyword that tells the compiler to create an object from a class such as &amp;lt;c&amp;gt;[[new]]&amp;lt;/c&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Classes are mostly defined by their fields and methods.  Fields are just like variables except they are tied to a class or object.  Methods are similar to functions and they always have access to the fields within their class definition as if they those fields were passed as a parameter to the method.  Sometimes a language will require the keyword prefix &amp;lt;c&amp;gt;[[self]]&amp;lt;/c&amp;gt; when referencing a field or method within the class definition.&lt;br /&gt;
&lt;br /&gt;
In C++, let's define an Animal class:&lt;br /&gt;
&lt;br /&gt;
 class Animal {&lt;br /&gt;
  protected:&lt;br /&gt;
    std::string name;&lt;br /&gt;
    int age;&lt;br /&gt;
  public:&lt;br /&gt;
    Animal(const std::string&amp;amp; name, int age)&lt;br /&gt;
        : name(name), age(age) {}&lt;br /&gt;
    virtual ~Animal() {}&lt;br /&gt;
    virtual void speak() const = 0; // Pure virtual function&lt;br /&gt;
    virtual void info() const {&lt;br /&gt;
        std::cout &amp;lt;&amp;lt; &amp;quot;Name: &amp;quot; &amp;lt;&amp;lt; name &amp;lt;&amp;lt; &amp;quot;, Age: &amp;quot; &amp;lt;&amp;lt; age &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In MiniScript, the same class would be defined as:&lt;br /&gt;
&amp;lt;ms&amp;gt;&lt;br /&gt;
 Animal = { name:&amp;quot;&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
 Animal.create = function(name, age)&lt;br /&gt;
   a = new Animal&lt;br /&gt;
   a.name = name&lt;br /&gt;
   a.age = age&lt;br /&gt;
   return a&lt;br /&gt;
 end function&lt;br /&gt;
&lt;br /&gt;
 Animal.speak = function&lt;br /&gt;
 end function&lt;br /&gt;
&lt;br /&gt;
 Animal.info = function&lt;br /&gt;
   print &amp;quot;Name: &amp;quot; + self.name + &amp;quot;, Age: &amp;quot; + self.age&lt;br /&gt;
 end function&lt;br /&gt;
&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Encapsulation ==&lt;br /&gt;
Encapsulation is more of a design technique to OOP programming and less of a technical aspect of any OOP language.  When you code using this technique, it allows the programmer to organize their project by grouping all behaviour and related data into classes.  When instantiated as an Object, this single container can be passed around in your code to &amp;quot;interact&amp;quot; with other objects.&lt;br /&gt;
&lt;br /&gt;
When coding with encapsulation in mind, all behaviours (methods) and properties (fields) related to a class will be defined in that class.  Knowing where to draw the line to include or exclude behaviour and properties tends to make or break an OOP design.  Often it is better to define something using multiple classes rather than trying to make one monolithic class.  A good rule of thumb is to dedicate a class to a single thing.&lt;br /&gt;
&lt;br /&gt;
Looking back at our Animal class above, we can see that it has two fields (name and age) and essentially two methods (speak and info).  Looking at &amp;lt;c&amp;gt;info()&amp;lt;/c&amp;gt; we can see that it only uses &amp;lt;c&amp;gt;name&amp;lt;/c&amp;gt; and &amp;lt;c&amp;gt;age&amp;lt;/c&amp;gt;.  As mentioned, that is what is defined in the class and so those are the only variables it has access to.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt; &amp;amp;#128218; The other two methods in C++ are the constructor and destructor.  In MiniScript, you are not required to have either of these.  However, creating a constructor may help to declutter your code and make it easier to read.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Inheritance ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
MiniScript supports prototype-based OOP through &amp;lt;c&amp;gt;[[new]]&amp;lt;/c&amp;gt;, &amp;lt;c&amp;gt;[[self]]&amp;lt;/c&amp;gt;,  &amp;lt;c&amp;gt;[[super]]&amp;lt;/c&amp;gt;, and &amp;lt;c&amp;gt;[[isa|__isa]]&amp;lt;/c&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Language]]&lt;/div&gt;</summary>
		<author><name>Redspark</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Object-oriented_programming&amp;diff=1415</id>
		<title>Object-oriented programming</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Object-oriented_programming&amp;diff=1415"/>
		<updated>2025-06-05T20:09:06Z</updated>

		<summary type="html">&lt;p&gt;Redspark: First draft not done yet.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Object-oriented programming (OOP) is a way of organizing code and data using objects, which are essentially self-contained units of data and methods that operate on that data. OOP is a fundamental approach to software development in many languages like Java, C++, and Python.&lt;br /&gt;
&lt;br /&gt;
OOP relies on certain key concepts:&lt;br /&gt;
* '''Classes and Objects''': A class is a blueprint for creating objects, which are instances of that class. &lt;br /&gt;
* '''Encapsulation''': Bundling data (fields) and methods (procedures) that operate on that data within a single unit (object). &lt;br /&gt;
* '''Inheritance''': Creating new classes (subclasses) based on existing classes (superclasses), inheriting their attributes and behaviors. &lt;br /&gt;
* '''Polymorphism''': Allowing objects of different classes to be treated as objects of a common superclass, enabling code reuse and flexibility. &lt;br /&gt;
&lt;br /&gt;
== Classes and Objects ==&lt;br /&gt;
In their most straightforward form, classes act as blueprints for objects.  It's like a how you can drive into a rural area of a city and find many new homes with the same design.  The developers used one set of architectural blueprints to build all of those houses.  In the same way, one class can be used to construct many objects.&lt;br /&gt;
&lt;br /&gt;
An object, on the other hand, is an actual active instance of a built class in memory. In most languages, there is a keyword that tells the compiler to create an object from a class such as &amp;lt;c&amp;gt;[[new]]&amp;lt;/c&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Classes are mostly defined by their fields and methods.  Fields are just like variables except they are tied to a class or object.  Methods are similar to functions and they always have access to the fields within their class definition as if they those fields were passed as a parameter to the method.  Sometimes a language will require the keyword prefix &amp;lt;c&amp;gt;[[self]]&amp;lt;/c&amp;gt; when referencing a field or method within the class definition.&lt;br /&gt;
&lt;br /&gt;
In C++, let's define an Animal class:&lt;br /&gt;
&lt;br /&gt;
 class Animal {&lt;br /&gt;
  protected:&lt;br /&gt;
    std::string name;&lt;br /&gt;
    int age;&lt;br /&gt;
&lt;br /&gt;
  public:&lt;br /&gt;
    Animal(const std::string&amp;amp; name, int age)&lt;br /&gt;
        : name(name), age(age) {}&lt;br /&gt;
&lt;br /&gt;
    virtual ~Animal() {}&lt;br /&gt;
&lt;br /&gt;
    virtual void speak() const = 0; // Pure virtual function&lt;br /&gt;
&lt;br /&gt;
    virtual void info() const {&lt;br /&gt;
        std::cout &amp;lt;&amp;lt; &amp;quot;Name: &amp;quot; &amp;lt;&amp;lt; name &amp;lt;&amp;lt; &amp;quot;, Age: &amp;quot; &amp;lt;&amp;lt; age &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
    }&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In MiniScript, the same class would be defined as:&lt;br /&gt;
&amp;lt;ms&amp;gt;&lt;br /&gt;
 Animal = { name:&amp;quot;&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
 Animal.create = function(name, age)&lt;br /&gt;
   a = new Animal&lt;br /&gt;
   a.name = name&lt;br /&gt;
   a.age = age&lt;br /&gt;
   return a&lt;br /&gt;
 end function&lt;br /&gt;
&lt;br /&gt;
 Animal.speak = function&lt;br /&gt;
 end function&lt;br /&gt;
&lt;br /&gt;
 Animal.info = function&lt;br /&gt;
   print &amp;quot;Name: &amp;quot; + self.name + &amp;quot;, Age: &amp;quot; + self.age&lt;br /&gt;
 end function&lt;br /&gt;
&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Encapsulation ==&lt;br /&gt;
Encapsulation is more of a design technique to OOP programming and less of a technical aspect of any OOP language.  When you code using this technique, it allows the programmer to organize their project by grouping all behaviour and related data into classes.  When instantiated as an Object, this single container can be passed around in your code to &amp;quot;interact&amp;quot; with other objects.&lt;br /&gt;
&lt;br /&gt;
When coding with encapsulation in mind, all behaviours (methods) and properties (fields) related to a class will be defined in that class.  Knowing where to draw the line to include or exclude behaviour and properties tends to make or break an OOP design.  Often it is better to define something using multiple classes rather than trying to make one monolithic class.  A good rule of thumb is to dedicate a class to a single thing.&lt;br /&gt;
&lt;br /&gt;
Looking back at our Animal class above, we can see that it has two fields (name and age) and essentially two methods (speak and info).  Looking at &amp;lt;c&amp;gt;info()&amp;lt;/c&amp;gt; we can see that it only uses &amp;lt;c&amp;gt;name&amp;lt;/c&amp;gt; and &amp;lt;c&amp;gt;age&amp;lt;/c&amp;gt;.  As mentioned, this is because that is all that is defined in the class and so those are the only variables it has access to.&lt;br /&gt;
&lt;br /&gt;
&amp;gt;! The other two methods in C++ are the constructor and destructor.  In MiniScript, you are not required to have either of these.  However, creating a constructor may help to declutter your code and make it easier to read.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Inheritance ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
MiniScript supports prototype-based OOP through &amp;lt;c&amp;gt;[[new]]&amp;lt;/c&amp;gt;, &amp;lt;c&amp;gt;[[self]]&amp;lt;/c&amp;gt;,  &amp;lt;c&amp;gt;[[super]]&amp;lt;/c&amp;gt;, and &amp;lt;c&amp;gt;[[isa|__isa]]&amp;lt;/c&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Language]]&lt;/div&gt;</summary>
		<author><name>Redspark</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=BmfFonts.Font&amp;diff=1412</id>
		<title>BmfFonts.Font</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=BmfFonts.Font&amp;diff=1412"/>
		<updated>2025-05-03T04:35:42Z</updated>

		<summary type="html">&lt;p&gt;Redspark: Initial Page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Font class is the one of two classes found in the [[bmfFonts]] module.  It is able to load BMF font files into memory and print them to a [[PixelDisplay]].&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Method !! Description&lt;br /&gt;
|-&lt;br /&gt;
| [[bmfFonts.Font.setKern|setKern]](c1, c2, kern) || Takes two character values and records the kern spacing between them.&lt;br /&gt;
|-&lt;br /&gt;
| [[bmfFonts.Font.kern|kern]](c1, c2) || Returns the appropriate spacing between two characters.  Defaults to 0 if there is no value for those two characters in the kernMap property.&lt;br /&gt;
|-&lt;br /&gt;
| [[bmfFonts.Font.load|load]](path) || Main entry point for reading a font from disk. Call this on the Font class itself (i.e. not an instance). Pass in the path to the font file and get back a new Font object.&lt;br /&gt;
|-&lt;br /&gt;
| [[bmfFonts.Font.save|save]](path) || Saves this font to disk, in either version 1.1 or version 1.2 format (depending on self.version).  Note that this method ignores self.data, and creates new data from the current font attributes and character data.&lt;br /&gt;
|-&lt;br /&gt;
| [[bmfFonts.Font.charData|charData]](c) || Gets the character data for the given character.  Returns null if not found.  (But if it fails to find a lowercase letter, it automatically looks for the upper case version.&lt;br /&gt;
|-&lt;br /&gt;
| [[bmfFonts.Font.addChar|addChar]](c, image, relX=0, relY=0, shift=null) || Adds a new character to this font.&lt;br /&gt;
|-&lt;br /&gt;
| [[bmfFonts.Font.renderChar|renderChar]](c, g, destX=0, destY=0) || Render the given character into any drawing context 'g' which has a setPixel method.&lt;br /&gt;
|-&lt;br /&gt;
| [[bmfFonts.Font.getCharImage|getCharImage]](c) || Make and return an Image of the given character.&lt;br /&gt;
|-&lt;br /&gt;
| [[bmfFonts.Font.makeCharImage|makeCharImage]](c) || Get an Image that represents the given character.  This method uses a cache, so is faster after the first call.&lt;br /&gt;
|-&lt;br /&gt;
| [[bmfFonts.Font.printChar|printChar]](c, x=480, y=320, scale=1, tint=&amp;quot;#FFFFFF&amp;quot;) || Render (draw) the given character to gfx, and return how far to shift the cursor.  This uses the image cache, so it gets faster after the first drawing of each character.&lt;br /&gt;
|-&lt;br /&gt;
| [[bmfFonts.Font.print|print]](s, x=20, y=320, scale=1, tint=&amp;quot;#FFFFFF&amp;quot;) || Print the given string to gfx at the given location.&lt;br /&gt;
|-&lt;br /&gt;
| [[bmfFonts.Font.printCentered|printCentered]](s, x=20, y=320, scale=1, tint=&amp;quot;#FFFFFF&amp;quot;) || Print the given string to gfx at the given location.&lt;br /&gt;
|-&lt;br /&gt;
| [[bmfFonts.Font.printRight|printRight]](s, x=940, y=320, scale=1, tint=&amp;quot;#FFFFFF&amp;quot;) || Print the given string to gfx, right-aligned on x.&lt;br /&gt;
|-&lt;br /&gt;
| [[bmfFonts.Font.width|width]](s, scale=1) || Return the width of the given string in this font.&lt;br /&gt;
|-&lt;br /&gt;
| [[bmfFonts.Font.lenToFit|lenToFit]](s, width=100) || Return the number of characters of the given string that fit a given width.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;/div&gt;</summary>
		<author><name>Redspark</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Import&amp;diff=1411</id>
		<title>Import</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Import&amp;diff=1411"/>
		<updated>2025-05-02T12:52:04Z</updated>

		<summary type="html">&lt;p&gt;Redspark: Fixed qa page link.  Removed Modules category since Import is a command and not a module.  importUtil is the module and it is already under the category Sys Modules.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;c&amp;gt;import&amp;lt;/c&amp;gt; is a function in [[Mini Micro]], [[Farmtronics]], [[command-line MiniScript]], and [[Soda]] that loads a MiniScript file from the current&lt;br /&gt;
directory, '''/sys/lib''', '''/usr/lib''', or some path defined in&lt;br /&gt;
[[env]].importPaths.  &amp;lt;c&amp;gt;import&amp;lt;/c&amp;gt; looks for a file with the module name plus &amp;quot;.ms&amp;quot;.&lt;br /&gt;
Any values defined by that code then become available in a map of the same name.  &lt;br /&gt;
&lt;br /&gt;
== Usage Notes ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;c&amp;gt;import&amp;lt;/c&amp;gt; imports the named module into the current local variable space.  Simple (and typical) usage is to do this at the top of your main program, where [[locals]] and [[globals]] are the same thing, which makes the imported module globally available.&lt;br /&gt;
&lt;br /&gt;
However, if you have a large, complex project composed of many interdependent modules, '''and''' you want those various modules to be testable on their own, then those modules are likely to be importing other modules, in what can rapidly become a tangle of imports that leads to several problems:&lt;br /&gt;
&lt;br /&gt;
# A recursive cycle of imports (e.g. A imports B which imports A) can result in an infinite loop.&lt;br /&gt;
# Importing a large module several times wastes time and makes your program take longer to load than necessary.&lt;br /&gt;
# If the module has any internal state, then you now have multiple separate copies of that internal state, which can lead to hard-to-find bugs.&lt;br /&gt;
&lt;br /&gt;
The solution to all these problems is to make a function like the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;// ensureImport: check whether the given module has been imported already&lt;br /&gt;
// (or is in the process of being imported).  If so, return immediately.&lt;br /&gt;
// If not, then import that module into the global namespace.&lt;br /&gt;
globals.ensureImport = function(moduleName)&lt;br /&gt;
	if globals.hasIndex(moduleName) then return&lt;br /&gt;
	globals[moduleName] = &amp;quot;PENDING&amp;quot;	// (module is being imported now)&lt;br /&gt;
	import moduleName&lt;br /&gt;
	globals[moduleName] = locals[moduleName]&lt;br /&gt;
end function&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Put this in some tiny, stand-alone script that can be safely imported from anywhere.  Import this with &amp;lt;c&amp;gt;import&amp;lt;/c&amp;gt;, but then load all other modules with the &amp;lt;c&amp;gt;ensureImport&amp;lt;/c&amp;gt; function it provides.  For example, if the above function is in a script called &amp;quot;coreUtils&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;import &amp;quot;coreUtils&amp;quot;&lt;br /&gt;
ensureImport &amp;quot;someModule&amp;quot;&lt;br /&gt;
ensureImport &amp;quot;someOtherOne&amp;quot;&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will ensure that no matter how your various files depend on each other, each one is only loaded once.&lt;br /&gt;
&lt;br /&gt;
'''Note:''' This &amp;lt;c&amp;gt;ensureImport&amp;lt;/c&amp;gt; function is available in the /sys/lib/importUtil standard library in Mini Micro.&lt;br /&gt;
&lt;br /&gt;
== Alternate Return Value ==&lt;br /&gt;
&lt;br /&gt;
Normally, all the file-scope variables (what would be &amp;lt;c&amp;gt;[[globals]]&amp;lt;/c&amp;gt; if the module were loaded and run by itself) are gathered into the map referenced by the name of the module itself.  However, it is possible to change this by executing a &amp;lt;c&amp;gt;[[return]]&amp;lt;/c&amp;gt; statement inside the module.  In this case, the name of the module will refer to whatever value you return.  See [https://luminaryapps.com/blog/advanced-import/index.html this blog post] for more detail.&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
The following example loads a script called &amp;quot;mathUtil.ms&amp;quot; (normally found in '''/sys/lib'''), and makes it available as a map called &amp;lt;c&amp;gt;mathUtil&amp;lt;/c&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;import &amp;quot;mathUtil&amp;quot;&lt;br /&gt;
print mathUtil.radToDeg(2*pi)  // prints 360&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some modules, like [[listUtil]], [[stringUtil]], and [[mapUtil]], extend these&lt;br /&gt;
built-in types with new methods.  For example, the built-in [[list]]&lt;br /&gt;
type does not have a .reverse method, but it does once you import&lt;br /&gt;
&amp;quot;listUtil&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;import &amp;quot;listUtil&amp;quot;&lt;br /&gt;
print [1,2,3].reverse  // prints [3, 2, 1]&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Further Reading ==&lt;br /&gt;
&lt;br /&gt;
* [https://luminaryapps.com/blog/advanced-import/index.html Advanced Tricks with Import] (blog post)&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Module name !! Contents &lt;br /&gt;
|-&lt;br /&gt;
| [[bmfFonts]] || BMF (bitmapped font) utilities &lt;br /&gt;
|-&lt;br /&gt;
| [[json]] || JSON utilities &lt;br /&gt;
|-&lt;br /&gt;
| [[QA|qa]] || Quality assurance (unit testing) utilities &lt;br /&gt;
|-&lt;br /&gt;
| [[listUtil]] || List utilities &lt;br /&gt;
|-&lt;br /&gt;
| [[mapUtil]] || Map (aka dictionary, hash table) utilities&lt;br /&gt;
|-&lt;br /&gt;
| [[mathUtil]] || Math utilities &lt;br /&gt;
|-&lt;br /&gt;
| [[stringUtil]] || String utilities&lt;br /&gt;
|-}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:Farmtronics]]&lt;/div&gt;</summary>
		<author><name>Redspark</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=StringUtil&amp;diff=1406</id>
		<title>StringUtil</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=StringUtil&amp;diff=1406"/>
		<updated>2025-04-05T04:58:53Z</updated>

		<summary type="html">&lt;p&gt;Redspark: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In [[Mini Micro]], &amp;lt;c&amp;gt;stringUtil&amp;lt;/c&amp;gt; is an [[import]] module in the &amp;lt;c&amp;gt;/sys/lib&amp;lt;/c&amp;gt; directory.  It provides various additional [[string]]-related functions, directly extending the [[string]] datatype.&lt;br /&gt;
&lt;br /&gt;
Like all the modules in &amp;lt;c&amp;gt;/sys/lib&amp;lt;/c&amp;gt;, the best documentation for stringUtil is the source code (&amp;lt;c&amp;gt;/sys/lib/stringUtil.ms&amp;lt;/c&amp;gt;) itself.  But this page summarizes the content in more concise form.&lt;br /&gt;
&lt;br /&gt;
== Constants ==&lt;br /&gt;
&lt;br /&gt;
The following values should be normally be prefixed with &amp;lt;c&amp;gt;stringUtil&amp;lt;/c&amp;gt;, e.g., &amp;lt;c&amp;gt;stringUtil.smallWords&amp;lt;/c&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Value / Purpose&lt;br /&gt;
|-&lt;br /&gt;
| smallWords || list of words that should not be capitalized in a title, except as the first word&lt;br /&gt;
|-&lt;br /&gt;
| TAB || &amp;lt;c&amp;gt;char(9)&amp;lt;/c&amp;gt;; tab character (advances to the next multiple of 4 spaces)&lt;br /&gt;
|-&lt;br /&gt;
| CR || &amp;lt;c&amp;gt;char(13)&amp;lt;/c&amp;gt;; carriage return (moves the cursor to the start of the next line)&lt;br /&gt;
|-&lt;br /&gt;
| LF || &amp;lt;c&amp;gt;char(10)&amp;lt;/c&amp;gt;; line feed (alternate line ending used in some files)&lt;br /&gt;
|-&lt;br /&gt;
| whitespace || common whitespace characters: space, TAB, CR, and LF&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Added string methods ==&lt;br /&gt;
&lt;br /&gt;
The following methods are added to the [[string]] type, and so are accessed using dot syntax after any string, for example: &amp;lt;c&amp;gt;&amp;quot;hello world&amp;quot;.titleCase&amp;lt;/c&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that because [[string]]s are immutable, none of these methods change the string they are called on; instead they return a new string (where applicable).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Method !! Returns&lt;br /&gt;
|-&lt;br /&gt;
| capitalized || capitalizes the first letter of the string&lt;br /&gt;
|-&lt;br /&gt;
| titleCase || capitalizes each word, except for small words&lt;br /&gt;
|-&lt;br /&gt;
| startsWith(''s'') || returns true if this string begins with ''s''&lt;br /&gt;
|-&lt;br /&gt;
| endsWith(''s'') || returns true if this string ends with ''s''&lt;br /&gt;
|-&lt;br /&gt;
| contains(''s'') || returns true if this string contains ''s''&lt;br /&gt;
|-&lt;br /&gt;
| isNumeric || returns true if this string is a valid number like &amp;quot;-3.1415&amp;quot;.  '''MiniMicro Only!'''&lt;br /&gt;
|-&lt;br /&gt;
| lastIndexOf(''substr'', ''beforeIdx''=null) || returns the *last* index of the given substring, optionally before a given index.  Returns null if not found.&lt;br /&gt;
|-&lt;br /&gt;
| pad(''length'', ''padChar''=&amp;quot; &amp;quot;, ''cutIfTooLong''=true) || pads a string by appending the given pad char, optionally cutting it if too long&lt;br /&gt;
|-&lt;br /&gt;
| trim(''charsToRemove''=whitespace) || trims the given set of characters off both ends of the string&lt;br /&gt;
|-&lt;br /&gt;
| trimRight(''charsToRemove''=whitespace) || trims the given set of characters off the end of the string&lt;br /&gt;
|-&lt;br /&gt;
| trimLeft(''charsToRemove''=whitespace) || trims the given set of characters off the start of the string&lt;br /&gt;
|-&lt;br /&gt;
| compress(''charToCompress''=&amp;quot; &amp;quot;) || replaces any runs of a given character with a single instance of that character.&lt;br /&gt;
|-&lt;br /&gt;
| ellideEnd(''maxLength''=10) || shortens a string and appends an ellipsis if the string is too long&lt;br /&gt;
|-&lt;br /&gt;
| ellideMiddle(''maxLength''=10) || shortens a string in the middle, inserting an ellipsis&lt;br /&gt;
|-&lt;br /&gt;
| reverse || reverses the string (e.g. Hello -&amp;gt; olleH)&lt;br /&gt;
|-&lt;br /&gt;
| splitLines || splits a string into lines by CR, LF, or CR+LF&lt;br /&gt;
|-&lt;br /&gt;
| wrap(''width''=67) || splits the string on spaces so that each line fits within the given width&lt;br /&gt;
|-&lt;br /&gt;
| cipher(charMap) || applies a substitution cipher, using the given character map&lt;br /&gt;
|-&lt;br /&gt;
| rot13 || applies the classic [https://en.wikipedia.org/wiki/ROT13 ROT-13] substitution cipher&lt;br /&gt;
|-&lt;br /&gt;
| urlEncode || Encode a string so it can be used as a URL query parameter.  '''MiniMicro Only!'''&lt;br /&gt;
|-&lt;br /&gt;
| urlDecode || convert a URL-encoded string back into plain text.  '''MiniMicro Only!'''&lt;br /&gt;
|-&lt;br /&gt;
| between(''startTag'', ''endTag'', ''after''=null) || find a string between two substrings.  This can be used, for example, to find text between two HTML tags.&lt;br /&gt;
|-&lt;br /&gt;
| editDistance(''s2'') || returns how many 1-character edits needed to transform this string into ''s2''&lt;br /&gt;
|-&lt;br /&gt;
| fill(''args'') || substitute values from ''args'' map into this string at places identified by &amp;quot;{key}&amp;quot;. (See ''string.match'' for the inverse operation.)&lt;br /&gt;
|-&lt;br /&gt;
| match(''pattern'') || takes a ''pattern'' string that may contain fields to fill in, identified by &amp;quot;{key}&amp;quot;.  If the this string can be matched to that pattern, then it returns a map with the key-value pairs filled in with the corresponding parts of this string.  If it can't match, then returns null. (See string.fill for the inverse operation.)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;import &amp;quot;stringUtil&amp;quot;&lt;br /&gt;
print &amp;quot;hello world&amp;quot;.titleCase.reverse  // prints: dlroW olleH&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Sys Modules]]&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:Command-Line_MiniScript]]&lt;/div&gt;</summary>
		<author><name>Redspark</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=StringUtil&amp;diff=1405</id>
		<title>StringUtil</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=StringUtil&amp;diff=1405"/>
		<updated>2025-04-05T04:52:35Z</updated>

		<summary type="html">&lt;p&gt;Redspark: Added missing methods&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In [[Mini Micro]], &amp;lt;c&amp;gt;stringUtil&amp;lt;/c&amp;gt; is an [[import]] module in the &amp;lt;c&amp;gt;/sys/lib&amp;lt;/c&amp;gt; directory.  It provides various additional [[string]]-related functions, directly extending the [[string]] datatype.&lt;br /&gt;
&lt;br /&gt;
Like all the modules in &amp;lt;c&amp;gt;/sys/lib&amp;lt;/c&amp;gt;, the best documentation for stringUtil is the source code (&amp;lt;c&amp;gt;/sys/lib/stringUtil.ms&amp;lt;/c&amp;gt;) itself.  But this page summarizes the content in more concise form.&lt;br /&gt;
&lt;br /&gt;
== Constants ==&lt;br /&gt;
&lt;br /&gt;
The following values should be normally be prefixed with &amp;lt;c&amp;gt;stringUtil&amp;lt;/c&amp;gt;, e.g., &amp;lt;c&amp;gt;stringUtil.smallWords&amp;lt;/c&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Value / Purpose&lt;br /&gt;
|-&lt;br /&gt;
| smallWords || list of words that should not be capitalized in a title, except as the first word&lt;br /&gt;
|-&lt;br /&gt;
| TAB || &amp;lt;c&amp;gt;char(9)&amp;lt;/c&amp;gt;; tab character (advances to the next multiple of 4 spaces)&lt;br /&gt;
|-&lt;br /&gt;
| CR || &amp;lt;c&amp;gt;char(13)&amp;lt;/c&amp;gt;; carriage return (moves the cursor to the start of the next line)&lt;br /&gt;
|-&lt;br /&gt;
| LF || &amp;lt;c&amp;gt;char(10)&amp;lt;/c&amp;gt;; line feed (alternate line ending used in some files)&lt;br /&gt;
|-&lt;br /&gt;
| whitespace || common whitespace characters: space, TAB, CR, and LF&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Added string methods ==&lt;br /&gt;
&lt;br /&gt;
The following methods are added to the [[string]] type, and so are accessed using dot syntax after any string, for example: &amp;lt;c&amp;gt;&amp;quot;hello world&amp;quot;.titleCase&amp;lt;/c&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that because [[string]]s are immutable, none of these methods change the string they are called on; instead they return a new string (where applicable).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Method !! Returns&lt;br /&gt;
|-&lt;br /&gt;
| capitalized || capitalizes the first letter of the string&lt;br /&gt;
|-&lt;br /&gt;
| titleCase || capitalizes each word, except for small words&lt;br /&gt;
|-&lt;br /&gt;
| startsWith(''s'') || returns true if this string begins with ''s''&lt;br /&gt;
|-&lt;br /&gt;
| endsWith(''s'') || returns true if this string ends with ''s''&lt;br /&gt;
|-&lt;br /&gt;
| contains(''s'') || returns true if this string contains ''s''&lt;br /&gt;
|-&lt;br /&gt;
| isNumeric || returns true if this string is a valid number like &amp;quot;-3.1415&amp;quot;.  '''MiniMicro Only!'''&lt;br /&gt;
|-&lt;br /&gt;
| lastIndexOf(''substr'', ''beforeIdx''=null) || returns the *last* index of the given substring, optionally before a given index.  Returns null if not found.&lt;br /&gt;
|-&lt;br /&gt;
| pad(''length'', ''padChar''=&amp;quot; &amp;quot;, ''cutIfTooLong''=true) || pads a string by appending the given pad char, optionally cutting it if too long&lt;br /&gt;
|-&lt;br /&gt;
| trim(''charsToRemove''=whitespace) || trims the given set of characters off both ends of the string&lt;br /&gt;
|-&lt;br /&gt;
| trimRight(''charsToRemove''=whitespace) || trims the given set of characters off the end of the string&lt;br /&gt;
|-&lt;br /&gt;
| trimLeft(''charsToRemove''=whitespace) || trims the given set of characters off the start of the string&lt;br /&gt;
|-&lt;br /&gt;
| compress(''charToCompress''=&amp;quot; &amp;quot;) || replaces any runs of a given character with a single instance of that character.&lt;br /&gt;
|-&lt;br /&gt;
| ellideEnd(''maxLength''=10) || shortens a string and appends an ellipsis if the string is too long&lt;br /&gt;
|-&lt;br /&gt;
| ellideMiddle(''maxLength''=10) || shortens a string in the middle, inserting an ellipsis&lt;br /&gt;
|-&lt;br /&gt;
| reverse || reverses the string (e.g. Hello -&amp;gt; olleH)&lt;br /&gt;
|-&lt;br /&gt;
| splitLines || splits a string into lines by CR, LF, or CR+LF&lt;br /&gt;
|-&lt;br /&gt;
| wrap(''width''=67) || splits the string on spaces so that each line fits within the given width&lt;br /&gt;
|-&lt;br /&gt;
| cipher(charMap) || applies a substitution cipher, using the given character map&lt;br /&gt;
|-&lt;br /&gt;
| rot13 || applies the classic [https://en.wikipedia.org/wiki/ROT13 ROT-13] substitution cipher&lt;br /&gt;
|-&lt;br /&gt;
| urlEncode || Encode a string so it can be used as a URL query parameter.&lt;br /&gt;
|-&lt;br /&gt;
| urlDecode || convert a URL-encoded string back into plain text.&lt;br /&gt;
|-&lt;br /&gt;
| between(''startTag'', ''endTag'', ''after''=null) || find a string between two substrings.  This can be used, for example, to find text between two HTML tags.&lt;br /&gt;
|-&lt;br /&gt;
| editDistance(''s2'') || returns how many 1-character edits needed to transform this string into ''s2''&lt;br /&gt;
|-&lt;br /&gt;
| fill(''args'') || substitute values from ''args'' map into this string at places identified by &amp;quot;{key}&amp;quot;. (See ''string.match'' for the inverse operation.)&lt;br /&gt;
|-&lt;br /&gt;
| match(''pattern'') || takes a ''pattern'' string that may contain fields to fill in, identified by &amp;quot;{key}&amp;quot;.  If the this string can be matched to that pattern, then it returns a map with the key-value pairs filled in with the corresponding parts of this string.  If it can't match, then returns null. (See string.fill for the inverse operation.)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;import &amp;quot;stringUtil&amp;quot;&lt;br /&gt;
print &amp;quot;hello world&amp;quot;.titleCase.reverse  // prints: dlroW olleH&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Sys Modules]]&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:Command-Line_MiniScript]]&lt;/div&gt;</summary>
		<author><name>Redspark</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=MathUtil&amp;diff=1404</id>
		<title>MathUtil</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=MathUtil&amp;diff=1404"/>
		<updated>2025-04-05T04:23:10Z</updated>

		<summary type="html">&lt;p&gt;Redspark: Added missing functions and marked some as MiniMicro only.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In [[Mini Micro]], &amp;lt;c&amp;gt;mathUtil&amp;lt;/c&amp;gt; is an [[import]] module in the &amp;lt;c&amp;gt;/sys/lib&amp;lt;/c&amp;gt; directory.  It provides various additional math-related functions and constants.&lt;br /&gt;
&lt;br /&gt;
Like all the modules in &amp;lt;c&amp;gt;/sys/lib&amp;lt;/c&amp;gt;, the best documentation for mathUtil is the source code (&amp;lt;c&amp;gt;/sys/lib/mathUtil.ms&amp;lt;/c&amp;gt;) itself.  But this page summarizes the content in more concise form.&lt;br /&gt;
&lt;br /&gt;
== Constant ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Value / Purpose&lt;br /&gt;
|-&lt;br /&gt;
| mathUtil.e || [https://en.wikipedia.org/wiki/E_(mathematical_constant) Euler's number], roughly 2.718; base of natural logarithms&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
&lt;br /&gt;
The following methods are normally accessed via the &amp;lt;c&amp;gt;mathUtil&amp;lt;/c&amp;gt; prefix, e.g. &amp;lt;c&amp;gt;mathUtil.radToDeg(pi)&amp;lt;/c&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Method !! Returns&lt;br /&gt;
|-&lt;br /&gt;
| ln(''x'') || natural logarithm of ''x''&lt;br /&gt;
|-&lt;br /&gt;
| radToDeg(''radians'') || converts ''radians'' into degrees&lt;br /&gt;
|-&lt;br /&gt;
| degToRad(''degrees'') || converts ''degrees'' into radians&lt;br /&gt;
|-&lt;br /&gt;
| moveTowards(''num'', ''targetNum'', ''maxChange''=1) || returns a value closer to ''targetNum'' from ''num'', differing from ''num'' by no more than ''maxChange'')&lt;br /&gt;
|-&lt;br /&gt;
| moveTowardsXY(''mover'', ''target'', ''maxDist''=1) || like &amp;lt;c&amp;gt;moveTowards&amp;lt;/c&amp;gt;, but mutates map ''mover'' to approach ''target'', each with ''x'' and ''y'' properties (e.g., a [[Sprite]])&lt;br /&gt;
|-&lt;br /&gt;
| distance(''p1'', ''p2'') || find the distance between two points; each may be a map containing ''x'' and ''y', or an [''x'', ''y''] list&lt;br /&gt;
|-&lt;br /&gt;
| lerp(''a'', ''b'', ''t'') || returns a value some portion ''t'' of the way from ''a'' to ''b''&lt;br /&gt;
|-&lt;br /&gt;
| lerp2d(''p1'', ''p2'', ''t'') || same as &amp;lt;c&amp;gt;lerp&amp;lt;/c&amp;gt;, but on 2d points (maps or lists)&lt;br /&gt;
|-&lt;br /&gt;
| proportionAlongLine(''endA'', ''endB'', ''p'') || returns how far ''p'' is along the line from ''endA'' to ''endB''&lt;br /&gt;
|-&lt;br /&gt;
| nearestPointOnLine(''endA'', ''endB'', ''p'') || returns closest point to ''p'' on the line from ''endA'' to ''endB'' as an [''x'', ''y''] list&lt;br /&gt;
|-&lt;br /&gt;
| nearestPointOnLineSegment(''endA'', ''endB'', ''p'') || same as &amp;lt;c&amp;gt;nearestPointOnLine&amp;lt;/c&amp;gt;, but limited to not go beyond the range from ''endA'' to ''endB''&lt;br /&gt;
|-&lt;br /&gt;
| distanceToLine(''endA'', ''endB'', ''p'') || returns distance from ''p'' to the line from ''endA'' to ''endB''&lt;br /&gt;
|-&lt;br /&gt;
| distanceToLineSegment(''endA'', ''endB'', ''p'') || same as &amp;lt;c&amp;gt;distanceToLine&amp;lt;/c&amp;gt;, but limited to not go beyond the range from ''endA'' to ''endB''&lt;br /&gt;
|-&lt;br /&gt;
| lineIntersectProportion(''p1'', ''p2'', ''p3'', ''p4'') || look for an intersection between line p1-p2 and line p3-p4.  Return null if none found.&lt;br /&gt;
|-&lt;br /&gt;
| lineSegmentsIntersect(''p1'', ''p2'', ''p3'', ''p4'') || return whether the line segment p1-p2 intersects segment p3-p4.&lt;br /&gt;
|-&lt;br /&gt;
| lineLineIntersection(''p1'', ''p2'', ''p3'', ''p4'') || return the point at which line p1-p2 intersects line p3-p4.  If there is no intersection, this function returns null.&lt;br /&gt;
|-&lt;br /&gt;
| reflect(''vector'', ''normal'') || reflects a vector across a given normal.  This does the classic &amp;quot;angle of incidence equals angle of reflection&amp;quot; thing, where the angle is measured relative to the given normal vector.  '''MiniMicro Only!'''&lt;br /&gt;
|-&lt;br /&gt;
| bounceVelocity(''ball'', ''lineSeg'', ''friction''=0.1) || Calculates the new velocity of something like a ball, after colliding with a (possibly moving) line segment.  '''MiniMicro Only!'''&lt;br /&gt;
|-&lt;br /&gt;
| bounceOffSegment(''ball'', ''segment'', ''friction''=0.1, ''fracBefore''=null) || Bounce a ball-like object -- which is attempting to move from ball.x-ball.vx, ball.y-ball.vy to ball.x, ball.y -- off of a line segment. '''MiniMicro Only!'''&lt;br /&gt;
|-&lt;br /&gt;
| bounceOffStaticPoly(''ball'', ''polyPts'', ''friction''=0.1) || Bounce a ball-like object -- which is attempting to move from ball.x-ball.vx, ball.y-ball.vy to ball.x, ball.y -- off of a stationary polygon with points defined by polyPts. Returns true if bounced, false if not. '''MiniMicro Only!'''&lt;br /&gt;
|-&lt;br /&gt;
| bounceOffPoly(''ball'', ''polyPts'', ''prevPolyPts''=null, ''friction''=0.1) || Bounce a ball-like object -- which is attempting to move from ball.x-ball.vx, ball.y-ball.vy to ball.x, ball.y -- off of a polygon with points defined by polyPts, possibly also moving from a previous position at prevPolyPts.  Returns true if bounced, false if not. '''MiniMicro Only!'''&lt;br /&gt;
|-&lt;br /&gt;
| bounceOffMovingPoly(''ball'', ''polyPts'', ''prevPolyPts''=null, ''friction''=0.1) || Bounce a ball-like object -- which is attempting to move from ball.x-ball.vx, ball.y-ball.vy to ball.x, ball.y -- off of a polygon with points defined by polyPts, also moving from a previous position at prevPolyPts. Returns true if bounced, false if not.  '''MiniMicro Only!'''&lt;br /&gt;
|-&lt;br /&gt;
| polyPerimeter(''polygon'') || returns total distance around ''polygon'' (given as list of [''x'', ''y'']] points)&lt;br /&gt;
|-&lt;br /&gt;
| polyArea(''polygon'') || returns area of ''polygon'' (given as list of [''x'', ''y'']] points)&lt;br /&gt;
|-&lt;br /&gt;
| pointInPoly(''point'', ''polygon'') || returns true if ''point'' (an [''x'', ''y''] point) is contained within ''polygon''; or if ''point'' is a list of ['x'', ''y''] points, returns true if any of those points are within ''polygon''&lt;br /&gt;
|-&lt;br /&gt;
| offsetPoly(''polygon'', ''delta'') || returns a new polygon by insetting/growing ''polygon'' by the given amount&lt;br /&gt;
|-&lt;br /&gt;
| shiftPoly(''polygon'', ''dx'', ''dy'') || returns a new polygon by translating ''polygon'' by the given amounts&lt;br /&gt;
|-&lt;br /&gt;
| rotatePoly(''polygon'', ''degrees'') || returns a new polygon by rotating ''polygon'' by ''degrees'' clockwise&lt;br /&gt;
|-&lt;br /&gt;
| randNormal(''mean''=0, ''stddev''=1) || returns a [https://en.wikipedia.org/wiki/Normal_distribution normally-distributed] random number&lt;br /&gt;
|-&lt;br /&gt;
| randRange(''min'', ''max'') || returns a random number between ''min'' and ''max''&lt;br /&gt;
|-&lt;br /&gt;
| dice(''numberOfDice''=1, ''sides''=6) || roll ''numberOfDice'' dice, each with values from 1 to ''sides'', and return the sum&lt;br /&gt;
|-&lt;br /&gt;
| clamp(''x'', ''minval''=0, ''maxval'=1) || return ''x'' limited to the range ''minval'' to ''maxval''&lt;br /&gt;
|-&lt;br /&gt;
| max(''a'', ''b'') || returns the greater of two values.&lt;br /&gt;
|-&lt;br /&gt;
| min(''a'', ''b'') || returns the lesser of two values.&lt;br /&gt;
|-&lt;br /&gt;
| numToStr(''n'', ''precision'') || convert ''n'' to a string, with a specified number of digits past the decimal place, with trailing zeros&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
The following program creates a sprite, then uses &amp;lt;c&amp;gt;mathUtil.moveTowardsXY&amp;lt;/c&amp;gt; to make it chase the mouse.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;import &amp;quot;mathUtil&amp;quot;&lt;br /&gt;
s = new Sprite&lt;br /&gt;
s.image = file.loadImage(&amp;quot;/sys/pics/Wumpus.png&amp;quot;)&lt;br /&gt;
display(4).sprites.push s&lt;br /&gt;
while true&lt;br /&gt;
	mathUtil.moveTowardsXY s, mouse, 10&lt;br /&gt;
	yield&lt;br /&gt;
end while&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Sys Modules]]&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:Command-Line_MiniScript]]&lt;/div&gt;</summary>
		<author><name>Redspark</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=ListUtil&amp;diff=1403</id>
		<title>ListUtil</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=ListUtil&amp;diff=1403"/>
		<updated>2025-04-05T02:27:31Z</updated>

		<summary type="html">&lt;p&gt;Redspark: Added missing methods&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In [[Mini Micro]], &amp;lt;c&amp;gt;listUtil&amp;lt;/c&amp;gt; is an [[import]] module in the &amp;lt;c&amp;gt;/sys/lib&amp;lt;/c&amp;gt; directory.  It provides various additional [[list]]-related functions, many of them directly extending the [[list]] datatype.&lt;br /&gt;
&lt;br /&gt;
Like all the modules in &amp;lt;c&amp;gt;/sys/lib&amp;lt;/c&amp;gt;, the best documentation for listUtil is the source code (&amp;lt;c&amp;gt;/sys/lib/listUtil.ms&amp;lt;/c&amp;gt;) itself.  But this page summarizes the content in more concise form.&lt;br /&gt;
&lt;br /&gt;
== Added list methods ==&lt;br /&gt;
&lt;br /&gt;
The following methods are added to the [[list]] type, and so are accessed using dot syntax after any list, for example: &amp;lt;c&amp;gt;[1, 2, 3].reverse&amp;lt;/c&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some of these methods mutate (modify) the list you call it on; others return a new list.  See below, or the header comments in the source code, for details.  Note that this is different from [[stringUtil]], where all methods return a new string (since [[string]]s are immutable).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Method !! Returns&lt;br /&gt;
|-&lt;br /&gt;
| contains(''item'') || true if this list contains the given ''item''&lt;br /&gt;
|-&lt;br /&gt;
| lastIndexOf(''element'', ''beforeIdx''=null) || returns the *last* index of the given element, optionally before a given index.  Returns null if not found.&lt;br /&gt;
|-&lt;br /&gt;
| split(''delimiter'', ''maxCount''=null) || similar to string.split, this splits a list into sub-lists by where the given delimiter element is found.&lt;br /&gt;
|-&lt;br /&gt;
| deepCopy || returns a clone of this list, recursively cloning any sub-lists as well&lt;br /&gt;
|-&lt;br /&gt;
| add(''addend'') || mutates this list by adding elements of another list of the same size, or by adding ''addend'' to all elements&lt;br /&gt;
|-&lt;br /&gt;
| plus(''addend'') || same as &amp;lt;c&amp;gt;add&amp;lt;/c&amp;gt;, but returns a new list, leaving this list unchanged&lt;br /&gt;
|-&lt;br /&gt;
| multiplyBy(''factor'') || mutates this list by multiplying elements of another list of the same size, or by multiplying all elements by ''factor''&lt;br /&gt;
|-&lt;br /&gt;
| times(''addend'') || same as &amp;lt;c&amp;gt;multiplyBy&amp;lt;/c&amp;gt;, but returns a new list, leaving this list unchanged&lt;br /&gt;
|-&lt;br /&gt;
| dot(''other'') || returns sum of pairwise products of elements in this list and ''other''&lt;br /&gt;
|-&lt;br /&gt;
| reverse || mutates this list by reversing the order of its elements&lt;br /&gt;
|-&lt;br /&gt;
| reversed || returns a new list containing the elements of this one in reverse order, leaving this list unchanged&lt;br /&gt;
|-&lt;br /&gt;
| apply(''func'') || mutates this list by applying a function to every element, in place&lt;br /&gt;
|-&lt;br /&gt;
| apply1(''func'', ''arg'') || same as &amp;lt;c&amp;gt;apply&amp;lt;/c&amp;gt;, but takes one extra argument&lt;br /&gt;
|-&lt;br /&gt;
| applied(''func'') || same as apply but returns a new list&lt;br /&gt;
|-&lt;br /&gt;
| applied1(''func'', ''arg'') || same as apply1 but returns a new list&lt;br /&gt;
|-&lt;br /&gt;
| mean || returns the average (sum divided by number of values) of this list&lt;br /&gt;
|-&lt;br /&gt;
| counts || returns a map that maps each unique element of this list, to the number of times that value occurs&lt;br /&gt;
|-&lt;br /&gt;
| distinct || returns a list of the unique values in this list (in arbitrary order)&lt;br /&gt;
|-&lt;br /&gt;
| product || returns the result of multiplying together all the elements in this list&lt;br /&gt;
|-&lt;br /&gt;
| min || returns the minimum value in this list&lt;br /&gt;
|-&lt;br /&gt;
| max || returns the maximum value in this list&lt;br /&gt;
|-&lt;br /&gt;
| reduce(''func'') || reduce the list to a single value by applying ''func'' to two values at a time&lt;br /&gt;
|-&lt;br /&gt;
| filter(''func'') || mutates this list by removing all elements ''x'' where ''func(x)'' is not true;&lt;br /&gt;
or where ''x.func'' is not true (if ''func'' is actually a string)&lt;br /&gt;
|-&lt;br /&gt;
| filter1(''func'', ''arg'') || same as ''filter'' but takes one extra argument.&lt;br /&gt;
|-&lt;br /&gt;
| filtered(''func'') || same as ''filter'', but returns a new list, leaving this list unchanged&lt;br /&gt;
|-&lt;br /&gt;
| filtered1(''func'', ''arg'') || same as ''filtered'' but takes one extra argument.&lt;br /&gt;
|-&lt;br /&gt;
| compress(''valueToCompress'') || replace each run of a given value with a single instance of that value (in place).&lt;br /&gt;
|-&lt;br /&gt;
| compressed(''valueToCompress'') || same as ''compress' but returns a new list.&lt;br /&gt;
|-&lt;br /&gt;
| valuesOf(''indexToExtract'') || returns a list containing ''elem[indexToExtract]'' for every element ''elem''&lt;br /&gt;
|-&lt;br /&gt;
| removeVal(''val'', ''removeAll''=false) || mutates this list, removing the first (or all) occurrence of ''val''&lt;br /&gt;
|-&lt;br /&gt;
| any || returns a random element of this list&lt;br /&gt;
|-&lt;br /&gt;
| swap(''index1'', ''index2'') || exchange two values in place, by their indexes&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Factory methods ==&lt;br /&gt;
&lt;br /&gt;
The following methods are also added to the [[list]] type, but are meant to be called as &amp;lt;c&amp;gt;list.init&amp;lt;/c&amp;gt;, &amp;lt;c&amp;gt;list.init2d&amp;lt;/c&amp;gt;, and &amp;lt;c&amp;gt;list.init3d&amp;lt;/c&amp;gt; rather than being called on an existing list.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Method !! Returns&lt;br /&gt;
|-&lt;br /&gt;
| init(''size'', ''initialValue'') || list containing ''size'' elements with value ''initialValue''&lt;br /&gt;
|-&lt;br /&gt;
| init2d(''rows'', ''columns'', ''initialValue'') || 2D array containing ''rows'' rows, each with ''columns'' elements with value ''initialValue''&lt;br /&gt;
|-&lt;br /&gt;
| init3d(''sizeA'', ''sizeB'', ''sizeC'', ''initialValue'') || 3D array containing ''sizeA'' 2D arrays&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
See also: [[matrixUtil]]&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;import &amp;quot;listUtil&amp;quot;&lt;br /&gt;
print [1, 2, 3].reversed  // prints: [3, 2, 1]&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Sys Modules]]&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:Command-Line_MiniScript]]&lt;/div&gt;</summary>
		<author><name>Redspark</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Vt&amp;diff=1402</id>
		<title>Vt</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Vt&amp;diff=1402"/>
		<updated>2025-04-05T01:58:06Z</updated>

		<summary type="html">&lt;p&gt;Redspark: Initial Page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This system module defines some special strings which, when printed on a VT100 or compatible terminal window, cause special things to happen: clear the screen, move the cursor, turn bold text on/off, etc.&lt;br /&gt;
&lt;br /&gt;
== Functions ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| [[vt.textColor|textColor(color)]] || Sets the foreground color of the text.  Specify a single number (index into the 256-color palette), or an [r,g,b] (each 255) list, or a RGB color string like &amp;quot;#FF8800&amp;quot;.  (In the latter two cases, we will automatically find as close match as we can in the color palette.)&lt;br /&gt;
|-&lt;br /&gt;
| [[vt.backColor|backColor(color)]] || Sets the background color of the text.  Specify a single number (index into the 256-color palette), or an [r,g,b] (each 255) list, or a RGB color string like &amp;quot;#FF8800&amp;quot;.  (In the latter two cases, we will automatically find as close match as we can in the color palette.)&lt;br /&gt;
|-&lt;br /&gt;
|[[vt.ledOn|ledOn(n=1)]] || Turns on LEDs, if your terminal has these (most don't anymore)&lt;br /&gt;
|-&lt;br /&gt;
|[[vt.ledOff|ledOff]] || Turns off LEDS.  Same as calling ledOn(0).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Properties ==&lt;br /&gt;
&lt;br /&gt;
=== color ===&lt;br /&gt;
Map of color names (to palete index) for use with textColor and backColor.  But note that you are not limited to these colors!  See notes above.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Value&lt;br /&gt;
|-&lt;br /&gt;
| color.aqua || 51&lt;br /&gt;
|-&lt;br /&gt;
| color.black || 232&lt;br /&gt;
|-&lt;br /&gt;
| color.blue||21&lt;br /&gt;
|-&lt;br /&gt;
| color.brown||137&lt;br /&gt;
|-&lt;br /&gt;
| color.fuchsia||201&lt;br /&gt;
|-&lt;br /&gt;
| color.gray||244&lt;br /&gt;
|-&lt;br /&gt;
| color.green||34&lt;br /&gt;
|-&lt;br /&gt;
| color.lime||46&lt;br /&gt;
|-&lt;br /&gt;
| color.maroon||124&lt;br /&gt;
|-&lt;br /&gt;
| color.navy||19&lt;br /&gt;
|-&lt;br /&gt;
| color.olive||142&lt;br /&gt;
|-&lt;br /&gt;
| color.orange||214&lt;br /&gt;
|-&lt;br /&gt;
| color.pink||217&lt;br /&gt;
|-&lt;br /&gt;
| color.purple||127&lt;br /&gt;
|-&lt;br /&gt;
| color.red||196&lt;br /&gt;
|-&lt;br /&gt;
| color.silver||250&lt;br /&gt;
|-&lt;br /&gt;
| color.teal||37&lt;br /&gt;
|-&lt;br /&gt;
| color.white||255&lt;br /&gt;
|-&lt;br /&gt;
| color.yellow||226&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== cursor ===&lt;br /&gt;
A map of cursor movement escape codes&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| cursor.up(n=1) || Moves cursor up n lines&lt;br /&gt;
|-&lt;br /&gt;
| cursor.down(n=1) || Moves cursor down n lines&lt;br /&gt;
|-&lt;br /&gt;
| cursor.left(n=1) || Moves cursor left n characters&lt;br /&gt;
|-&lt;br /&gt;
| cursor.right(n=1) || Moves cursor right n characters&lt;br /&gt;
|-&lt;br /&gt;
| cursor.nextLine || Moves cursor to beginning of the next line of characters&lt;br /&gt;
|-&lt;br /&gt;
| cursor.home || Moves cursor to upper left&lt;br /&gt;
|-&lt;br /&gt;
| cursor.save || Saves cursor position and attributes&lt;br /&gt;
|-&lt;br /&gt;
| cursor.restore || Restores cursor position and attributes&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== tab ===&lt;br /&gt;
A map of tab escape codes&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| tab.set || Sets a tab stop at the current column&lt;br /&gt;
|-&lt;br /&gt;
| tab.clear || Clear a tab stop at the current column&lt;br /&gt;
|-&lt;br /&gt;
| tab.clearAll || Clears all tab stops&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== text size ===&lt;br /&gt;
Escape codes for changing the text size&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| bigTextTop || big text!  Requires printing your message twice, once with the &amp;quot;top half&amp;quot; mode &lt;br /&gt;
|-&lt;br /&gt;
| bigTextBottom || and again with the &amp;quot;bottom half&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
| wide || or you can print double-wide, normal-height text.&lt;br /&gt;
|-&lt;br /&gt;
| normalSize || Turns off any of these size changes.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== clearing text ===&lt;br /&gt;
Escape codes to clear all or part of the screen&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| clear || Clear entire screen&lt;br /&gt;
|-&lt;br /&gt;
| clearLineToRight|| Clear line from cursor right&lt;br /&gt;
|-&lt;br /&gt;
| clearLineToLeft || Clear line from cursor left&lt;br /&gt;
|-&lt;br /&gt;
| clearLine || Clear entire line&lt;br /&gt;
|-&lt;br /&gt;
| clearBelow || Clear screen from cursor down&lt;br /&gt;
|-&lt;br /&gt;
| clearAbove || Clear screen from cursor up&lt;br /&gt;
|-&lt;br /&gt;
| reset || Clears, plus also resets all state&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Sys Modules]]&lt;br /&gt;
[[Category:Command-Line_MiniScript]]&lt;/div&gt;</summary>
		<author><name>Redspark</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Grfon&amp;diff=1401</id>
		<title>Grfon</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Grfon&amp;diff=1401"/>
		<updated>2025-04-05T01:12:59Z</updated>

		<summary type="html">&lt;p&gt;Redspark: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;GRFON is a simpler and gentler file format compared to JSON and was designed to be especially human-editable.  For information on the GRFON file specification, see:  https://github.com/JoeStrout/grfon/blob/main/docs/README.md&lt;br /&gt;
&lt;br /&gt;
== Functions ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| [[grfon.parse|parse(string)]] || convert a GRFON string into a MiniScript value (which could include a list or map of other values).  This is the main entry point for reading GRFON data and converting it to native form.&lt;br /&gt;
|-&lt;br /&gt;
| [[grfon.escape|escape(string)]]  || Escape any special characters in the given string by preceding them with backslashes.&lt;br /&gt;
|-&lt;br /&gt;
| [[grfon.unescape|unescape(string)]] || Replaces backslash sequences in the given string with the appropriate character.&lt;br /&gt;
|-&lt;br /&gt;
| [[grfon.toGRFON| toGRFON((value, compact=false, indent=0, topLevel=true)]] || Converts a value to GRFON syntax.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Properties ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| interpretTrueAndFalse || Flag to control whether strings &amp;quot;true&amp;quot; and &amp;quot;false&amp;quot; should be returned as 1 or 0, or left as strings.&lt;br /&gt;
|-&lt;br /&gt;
| interpretNull || Similar flag for string &amp;quot;null&amp;quot;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Examples ===&lt;br /&gt;
&amp;lt;ms&amp;gt;&lt;br /&gt;
s = toGRFON([1, 2, &amp;quot;foo&amp;quot;], true)&lt;br /&gt;
&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Sys Modules]]&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:Command-Line_MiniScript]]&lt;/div&gt;</summary>
		<author><name>Redspark</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=QA&amp;diff=1400</id>
		<title>QA</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=QA&amp;diff=1400"/>
		<updated>2025-04-05T01:10:56Z</updated>

		<summary type="html">&lt;p&gt;Redspark: Initial Page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This system module provides functions for helping assure the quality of your code: assert conditions that you think should always be true, or otherwise check your assumptions and report when they fail.&lt;br /&gt;
&lt;br /&gt;
== Functions ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| [[qa.abort|abort(errMsg)]] || Prints a stack trace (optionally, after an error message), then exits the program.&lt;br /&gt;
|-&lt;br /&gt;
| [[qa.assert|assert(condition, desc)]] || Abort if the given condition is not true.  Error message can include the given (optional) description.&lt;br /&gt;
|-&lt;br /&gt;
| [[qa.assertEqual|assertEqual(actual, expected, note)]] || Abort if the first two parameters are not equal.  Additional descriptive note is optional.&lt;br /&gt;
|-&lt;br /&gt;
| [[qa.typeOf|typeOf(value)]] || Returns a the name of the data type as a String.&lt;br /&gt;
|-&lt;br /&gt;
| [[qa.assertType|assertType(value, type, note)]] || Abort if the first parameter is not of the specified type.  Additional descriptive note is optional.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&amp;lt;ms&amp;gt;&lt;br /&gt;
  import &amp;quot;qa&amp;quot;&lt;br /&gt;
&lt;br /&gt;
  test = function (data)&lt;br /&gt;
    qa.assertType(data, map)&lt;br /&gt;
  end function&lt;br /&gt;
&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Sys Modules]]&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:Command-Line_MiniScript]]&lt;/div&gt;</summary>
		<author><name>Redspark</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=MatrixUtil&amp;diff=1399</id>
		<title>MatrixUtil</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=MatrixUtil&amp;diff=1399"/>
		<updated>2025-04-05T00:52:22Z</updated>

		<summary type="html">&lt;p&gt;Redspark: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This system module defines the Matrix class. A matrix is a 2D array of numbers.  These have lots of uses in computer graphics. In keeping with standard programming convention, but NOT standard math convention, we use 0-base indexing.  So the top-left element is 0,0.&lt;br /&gt;
&lt;br /&gt;
== Class ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
|[[matrixUtil.Matrix|Matrix]] || Defines a Matrix class in global namespace.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Sys Modules]]&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:Command-Line_MiniScript]]&lt;/div&gt;</summary>
		<author><name>Redspark</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=DateTime&amp;diff=1398</id>
		<title>DateTime</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=DateTime&amp;diff=1398"/>
		<updated>2025-04-05T00:51:23Z</updated>

		<summary type="html">&lt;p&gt;Redspark: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Mini Micro supports dates/times in two different formats: as a string (by default in SQL format), and as a number of seconds since a reference date (Jan 01, 2000).  The numeric format is useful for doing date/time calculations, like finding the amount of time between two dates, or adding some amount of time to a starting date/time.&lt;br /&gt;
&lt;br /&gt;
For details on the format specifiers: https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings .&lt;br /&gt;
&lt;br /&gt;
== Functions ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| [[dateTime.nowVal|nowVal]] || Get the current date/time, as a number.&lt;br /&gt;
|-&lt;br /&gt;
| [[dateTime.now|now(format)]] || Return the current date/time as a string. By default, format = &amp;quot;yyyy-MM-dd HH:mm:ss&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
| [[dateTime.str|str(date, format)]] || Convert a date (string or number) to a string with the given format. By default, format = &amp;quot;yyyy-MM-dd HH:mm:ss&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
| [[dateTime.val|val(dateStr)]] || Convert a date string to a number. By default, format = &amp;quot;yyyy-MM-dd HH:mm:ss&amp;quot;.  If no date string is given, returns the current time (same as nowVal).&lt;br /&gt;
|-&lt;br /&gt;
| [[dateTime.year|year(date)]] || Get the year of the given date, as a number.&lt;br /&gt;
|-&lt;br /&gt;
| [[dateTime.month|month(date)]] || Get the month of the given date, as a number from 1 to 12.&lt;br /&gt;
|-&lt;br /&gt;
| [[dateTime.day|day(date)]] || Get the day of the given date, as a number from 1 to 31.&lt;br /&gt;
|-&lt;br /&gt;
| [[dateTime.hour|hour(date)]] || Get the hour of the given date/time, as a number from 0 to 23.&lt;br /&gt;
|-&lt;br /&gt;
| [[dateTime.minute|minute(date)]] || Get the minute of the given date/time, as a number from 0 to 59.&lt;br /&gt;
|-&lt;br /&gt;
| [[dateTime.second|second(date)]] || Get the second of the given date, as a number from 0 to 59.&lt;br /&gt;
|-&lt;br /&gt;
| [[dateTime.weekday|weekday(date)]] || Get the day of the week for the given date, from 0 (Sunday) to 6 (Saturday).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Properties ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| [[dateTime.weekdayNames | weekdayNames]] || Weekday name abbreviations, in the order returned by the weekday function.  DO NOT CHANGE THESE, or the weekday function will no longer work.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&amp;lt;ms&amp;gt;&lt;br /&gt;
	import &amp;quot;dateTime&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	print &amp;quot;It is now: &amp;quot; + dateTime.now&lt;br /&gt;
&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Sys Modules]]&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:Command-Line_MiniScript]]&lt;/div&gt;</summary>
		<author><name>Redspark</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=StringUtil&amp;diff=1397</id>
		<title>StringUtil</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=StringUtil&amp;diff=1397"/>
		<updated>2025-04-05T00:50:59Z</updated>

		<summary type="html">&lt;p&gt;Redspark: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In [[Mini Micro]], &amp;lt;c&amp;gt;stringUtil&amp;lt;/c&amp;gt; is an [[import]] module in the &amp;lt;c&amp;gt;/sys/lib&amp;lt;/c&amp;gt; directory.  It provides various additional [[string]]-related functions, directly extending the [[string]] datatype.&lt;br /&gt;
&lt;br /&gt;
Like all the modules in &amp;lt;c&amp;gt;/sys/lib&amp;lt;/c&amp;gt;, the best documentation for stringUtil is the source code (&amp;lt;c&amp;gt;/sys/lib/stringUtil.ms&amp;lt;/c&amp;gt;) itself.  But this page summarizes the content in more concise form.&lt;br /&gt;
&lt;br /&gt;
== Constants ==&lt;br /&gt;
&lt;br /&gt;
The following values should be normally be prefixed with &amp;lt;c&amp;gt;stringUtil&amp;lt;/c&amp;gt;, e.g., &amp;lt;c&amp;gt;stringUtil.smallWords&amp;lt;/c&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Value / Purpose&lt;br /&gt;
|-&lt;br /&gt;
| smallWords || list of words that should not be capitalized in a title, except as the first word&lt;br /&gt;
|-&lt;br /&gt;
| TAB || &amp;lt;c&amp;gt;char(9)&amp;lt;/c&amp;gt;; tab character (advances to the next multiple of 4 spaces)&lt;br /&gt;
|-&lt;br /&gt;
| CR || &amp;lt;c&amp;gt;char(13)&amp;lt;/c&amp;gt;; carriage return (moves the cursor to the start of the next line)&lt;br /&gt;
|-&lt;br /&gt;
| LF || &amp;lt;c&amp;gt;char(10)&amp;lt;/c&amp;gt;; line feed (alternate line ending used in some files)&lt;br /&gt;
|-&lt;br /&gt;
| whitespace || common whitespace characters: space, TAB, CR, and LF&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Added string methods ==&lt;br /&gt;
&lt;br /&gt;
The following methods are added to the [[string]] type, and so are accessed using dot syntax after any string, for example: &amp;lt;c&amp;gt;&amp;quot;hello world&amp;quot;.titleCase&amp;lt;/c&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that because [[string]]s are immutable, none of these methods change the string they are called on; instead they return a new string (where applicable).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Method !! Returns&lt;br /&gt;
|-&lt;br /&gt;
| capitalized || capitalizes the first letter of the string&lt;br /&gt;
|-&lt;br /&gt;
| titleCase || capitalizes each word, except for small words&lt;br /&gt;
|-&lt;br /&gt;
| startsWith(''s'') || returns true if this string begins with ''s''&lt;br /&gt;
|-&lt;br /&gt;
| endsWith(''s'') || returns true if this string ends with ''s''&lt;br /&gt;
|-&lt;br /&gt;
| contains(''s'') || returns true if this string contains ''s''&lt;br /&gt;
|-&lt;br /&gt;
| pad(''length'', ''padChar''=&amp;quot; &amp;quot;, ''cutIfTooLong''=true) || pads a string by appending the given pad char, optionally cutting it if too long&lt;br /&gt;
|-&lt;br /&gt;
| trim(''charsToRemove''=whitespace) || trims the given set of characters off both ends of the string&lt;br /&gt;
|-&lt;br /&gt;
| trimRight(''charsToRemove''=whitespace) || trims the given set of characters off the end of the string&lt;br /&gt;
|-&lt;br /&gt;
| trimLeft(''charsToRemove''=whitespace) || trims the given set of characters off the start of the string&lt;br /&gt;
|-&lt;br /&gt;
| ellideEnd(''maxLength''=10) || shortens a string and appends an ellipsis if the string is too long&lt;br /&gt;
|-&lt;br /&gt;
| ellideMiddle(''maxLength''=10) || shortens a string in the middle, inserting an ellipsis&lt;br /&gt;
|-&lt;br /&gt;
| reverse || reverses the string (e.g. Hello -&amp;gt; olleH)&lt;br /&gt;
|-&lt;br /&gt;
| splitLines || splits a string into lines by CR, LF, or CR+LF&lt;br /&gt;
|-&lt;br /&gt;
| wrap(''width''=67) || splits the string on spaces so that each line fits within the given width&lt;br /&gt;
|-&lt;br /&gt;
| cipher(charMap) || applies a substitution cipher, using the given character map&lt;br /&gt;
|-&lt;br /&gt;
| rot13 || applies the classic [https://en.wikipedia.org/wiki/ROT13 ROT-13] substitution cipher&lt;br /&gt;
|-&lt;br /&gt;
| editDistance = function(''s2'') || returns how many 1-character edits needed to transform this string into ''s2''&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;import &amp;quot;stringUtil&amp;quot;&lt;br /&gt;
print &amp;quot;hello world&amp;quot;.titleCase.reverse  // prints: dlroW olleH&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Sys Modules]]&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:Command-Line_MiniScript]]&lt;/div&gt;</summary>
		<author><name>Redspark</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=MapUtil&amp;diff=1396</id>
		<title>MapUtil</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=MapUtil&amp;diff=1396"/>
		<updated>2025-04-05T00:50:13Z</updated>

		<summary type="html">&lt;p&gt;Redspark: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In [[Mini Micro]], &amp;lt;c&amp;gt;mapUtil&amp;lt;/c&amp;gt; is an [[import]] module in the &amp;lt;c&amp;gt;/sys/lib&amp;lt;/c&amp;gt; directory.  It provides various additional [[map]]-related functions, directly extending the [[map]] datatype.&lt;br /&gt;
&lt;br /&gt;
Like all the modules in &amp;lt;c&amp;gt;/sys/lib&amp;lt;/c&amp;gt;, the best documentation for mapUtil is the source code (&amp;lt;c&amp;gt;/sys/lib/mapUtil.ms&amp;lt;/c&amp;gt;) itself.  But this page summarizes the content in more concise form.&lt;br /&gt;
&lt;br /&gt;
=== Constants ===&lt;br /&gt;
The following values should be normally be prefixed with &amp;lt;c&amp;gt;mapUtil&amp;lt;/c&amp;gt;, e.g., &amp;lt;c&amp;gt;mapUtil.fromTo&amp;lt;/c&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Value / Purpose&lt;br /&gt;
|-&lt;br /&gt;
| fromTo || generate a map from one sequence (list or string) to another.  The two sequences must be the same length.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Added map methods ===&lt;br /&gt;
The following methods are added to the [[map]] type, and so are accessed using dot syntax after any map, for example: &amp;lt;c&amp;gt;{&amp;quot;Hello&amp;quot;: &amp;quot;World&amp;quot;}.inverse&amp;lt;/c&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Method !! Returns&lt;br /&gt;
|-&lt;br /&gt;
| get(''key'', ''defaultValue=null'') || look up the value for an index in this map, but if the given index is not found, return a default value instead. Works with inherited values, too.&lt;br /&gt;
|-&lt;br /&gt;
| hasValue(''v'', ''includeInherited=false'') || return true if this map contains the given value as a value (compare with built-in function .hasIndex, which checks whether this map has a given value as a key).  By default this&lt;br /&gt;
does not walk the inheritance chain (just like .hasIndex), but&lt;br /&gt;
if you pass ''true'' as the second parameter, then it does.&lt;br /&gt;
|-&lt;br /&gt;
| sortedIndexes || get the indexes of this map, but in sorted order (rather than undefined order as .indexes gives you).&lt;br /&gt;
|-&lt;br /&gt;
| inverse || return a new map that has the keys and values swapped (keys of this map become values of the result map, and vice versa).&lt;br /&gt;
|- &lt;br /&gt;
| filterIndexes(''func'') || remove any indexes for which the given function does not return true.&lt;br /&gt;
|-&lt;br /&gt;
| filterValues(''func'') || remove any key/value pairs for which the function, applied to the value, does not return true.&lt;br /&gt;
|-&lt;br /&gt;
| applyToValues(''func'') || apply the given function to all values.&lt;br /&gt;
|-&lt;br /&gt;
| pairs || get all key/value pairs as a list (in arbitrary order) of little maps with &amp;quot;key&amp;quot; and &amp;quot;value&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
| swap(''key1'', ''key2'') || swap the values of two keys.  Note that this may be applied to locals (or globals), enabling you to swap the values of two variables.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;import &amp;quot;mapUtil&amp;quot;&lt;br /&gt;
print {&amp;quot;Hello&amp;quot;: &amp;quot;World&amp;quot;}.inverse //prints {&amp;quot;World&amp;quot;: &amp;quot;Hello&amp;quot;}&lt;br /&gt;
&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Sys Modules]]&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:Command-Line_MiniScript]]&lt;/div&gt;</summary>
		<author><name>Redspark</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=ListUtil&amp;diff=1395</id>
		<title>ListUtil</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=ListUtil&amp;diff=1395"/>
		<updated>2025-04-05T00:49:43Z</updated>

		<summary type="html">&lt;p&gt;Redspark: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In [[Mini Micro]], &amp;lt;c&amp;gt;listUtil&amp;lt;/c&amp;gt; is an [[import]] module in the &amp;lt;c&amp;gt;/sys/lib&amp;lt;/c&amp;gt; directory.  It provides various additional [[list]]-related functions, many of them directly extending the [[list]] datatype.&lt;br /&gt;
&lt;br /&gt;
Like all the modules in &amp;lt;c&amp;gt;/sys/lib&amp;lt;/c&amp;gt;, the best documentation for listUtil is the source code (&amp;lt;c&amp;gt;/sys/lib/listUtil.ms&amp;lt;/c&amp;gt;) itself.  But this page summarizes the content in more concise form.&lt;br /&gt;
&lt;br /&gt;
== Added list methods ==&lt;br /&gt;
&lt;br /&gt;
The following methods are added to the [[list]] type, and so are accessed using dot syntax after any list, for example: &amp;lt;c&amp;gt;[1, 2, 3].reverse&amp;lt;/c&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some of these methods mutate (modify) the list you call it on; others return a new list.  See below, or the header comments in the source code, for details.  Note that this is different from [[stringUtil]], where all methods return a new string (since [[string]]s are immutable).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Method !! Returns&lt;br /&gt;
|-&lt;br /&gt;
| contains(''item'') || true if this list contains the given ''item''&lt;br /&gt;
|-&lt;br /&gt;
| deepCopy || returns a clone of this list, recursively cloning any sub-lists as well&lt;br /&gt;
|-&lt;br /&gt;
| add(''addend'') || mutates this list by adding elements of another list of the same size, or by adding ''addend'' to all elements&lt;br /&gt;
|-&lt;br /&gt;
| plus(''addend'') || same as &amp;lt;c&amp;gt;add&amp;lt;/c&amp;gt;, but returns a new list, leaving this list unchanged&lt;br /&gt;
|-&lt;br /&gt;
| multiplyBy(''factor'') || mutates this list by multiplying elements of another list of the same size, or by multiplying all elements by ''factor''&lt;br /&gt;
|-&lt;br /&gt;
| times(''addend'') || same as &amp;lt;c&amp;gt;multiplyBy&amp;lt;/c&amp;gt;, but returns a new list, leaving this list unchanged&lt;br /&gt;
|-&lt;br /&gt;
| dot(''other'') || returns sum of pairwise products of elements in this list and ''other''&lt;br /&gt;
|-&lt;br /&gt;
| reverse || mutates this list by reversing the order of its elements&lt;br /&gt;
|-&lt;br /&gt;
| reversed || returns a new list containing the elements of this one in reverse order, leaving this list unchanged&lt;br /&gt;
|-&lt;br /&gt;
| apply(''func'') || mutates this list by applying a function to every element, in place&lt;br /&gt;
|-&lt;br /&gt;
| apply1(''func'', ''arg'') || same as &amp;lt;c&amp;gt;apply&amp;lt;/c&amp;gt;, but takes one extra argument&lt;br /&gt;
|-&lt;br /&gt;
| mean || returns the average (sum divided by number of values) of this list&lt;br /&gt;
|-&lt;br /&gt;
| counts || returns a map that maps each unique element of this list, to the number of times that value occurs&lt;br /&gt;
|-&lt;br /&gt;
| distinct || returns a list of the unique values in this list (in arbitrary order)&lt;br /&gt;
|-&lt;br /&gt;
| product || returns the result of multiplying together all the elements in this list&lt;br /&gt;
|-&lt;br /&gt;
| min || returns the minimum value in this list&lt;br /&gt;
|-&lt;br /&gt;
| max || returns the maximum value in this list&lt;br /&gt;
|-&lt;br /&gt;
| reduce(''func'') || reduce the list to a single value by applying ''func'' to two values at a time&lt;br /&gt;
|-&lt;br /&gt;
| filter(''func'') || mutates this list by removing all elements ''x'' where ''func(x)'' is not true;&lt;br /&gt;
or where ''x.func'' is not true (if ''func'' is actually a string)&lt;br /&gt;
|-&lt;br /&gt;
| filtered(''func'') || same as ''filter'', but returns a new list, leaving this list unchanged&lt;br /&gt;
|-&lt;br /&gt;
| valuesOf(''indexToExtract'') || returns a list containing ''elem[indexToExtract]'' for every element ''elem''&lt;br /&gt;
|-&lt;br /&gt;
| removeVal(''val'', ''removeAll''=false) || mutates this list, removing the first (or all) occurrence of ''val''&lt;br /&gt;
|-&lt;br /&gt;
| any || returns a random element of this list&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Factory methods ==&lt;br /&gt;
&lt;br /&gt;
The following methods are also added to the [[list]] type, but are meant to be called as &amp;lt;c&amp;gt;list.init&amp;lt;/c&amp;gt;, &amp;lt;c&amp;gt;list.init2d&amp;lt;/c&amp;gt;, and &amp;lt;c&amp;gt;list.init3d&amp;lt;/c&amp;gt; rather than being called on an existing list.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Method !! Returns&lt;br /&gt;
|-&lt;br /&gt;
| init(''size'', ''initialValue'') || list containing ''size'' elements with value ''initialValue''&lt;br /&gt;
|-&lt;br /&gt;
| init2d(''rows'', ''columns'', ''initialValue'') || 2D array containing ''rows'' rows, each with ''columns'' elements with value ''initialValue''&lt;br /&gt;
|-&lt;br /&gt;
| init3d(''sizeA'', ''sizeB'', ''sizeC'', ''initialValue'') || 3D array containing ''sizeA'' 2D arrays&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
See also: [[matrixUtil]]&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;import &amp;quot;listUtil&amp;quot;&lt;br /&gt;
print [1, 2, 3].reversed  // prints: [3, 2, 1]&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Sys Modules]]&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:Command-Line_MiniScript]]&lt;/div&gt;</summary>
		<author><name>Redspark</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Json&amp;diff=1394</id>
		<title>Json</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Json&amp;diff=1394"/>
		<updated>2025-04-05T00:49:07Z</updated>

		<summary type="html">&lt;p&gt;Redspark: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In [[Mini Micro]], &amp;lt;c&amp;gt;json&amp;lt;/c&amp;gt; is an [[import]] module in the &amp;lt;c&amp;gt;/sys/lib&amp;lt;/c&amp;gt; directory.  It provides conversion of MiniScript values to and from [https://www.json.org/ JSON] format, as well as some related utility functions.&lt;br /&gt;
&lt;br /&gt;
Like all the modules in &amp;lt;c&amp;gt;/sys/lib&amp;lt;/c&amp;gt;, the best documentation for the json module is the source code (&amp;lt;c&amp;gt;/sys/lib/json.ms&amp;lt;/c&amp;gt;) itself.  But this page summarizes the content in more concise form.&lt;br /&gt;
&lt;br /&gt;
== Functions ==&lt;br /&gt;
&lt;br /&gt;
After [[import|importing]] &amp;quot;json&amp;quot;, the following methods may be accessed under the &amp;lt;c&amp;gt;json&amp;lt;/c&amp;gt; map (e.g. as &amp;lt;c&amp;gt;json.parse&amp;lt;/c&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Method !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| parse(''jsonString'') || parses JSON data into native MiniScript values&lt;br /&gt;
|-&lt;br /&gt;
| toJSON(''value'', ''compact''=false, ''indent''=0) || converts MiniScript values into JSON format&lt;br /&gt;
|-&lt;br /&gt;
| hexToInt(''s'') || convert hexadecimal string (e.g. &amp;quot;002A&amp;quot;) to the equivalent number (42)&lt;br /&gt;
|-&lt;br /&gt;
| escape(''s'') || change special characters into backslash sequences&lt;br /&gt;
|-&lt;br /&gt;
| unescape(''s'') || replace backslash sequences with normal characters&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
The following example builds a simple MiniScript data structure, then writes this out to a file in JSON format.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;import &amp;quot;json&amp;quot;&lt;br /&gt;
&lt;br /&gt;
data = {&amp;quot;name&amp;quot;:&amp;quot;Alice&amp;quot;, &amp;quot;job&amp;quot;:&amp;quot;Engineer&amp;quot;}&lt;br /&gt;
data.kids = []&lt;br /&gt;
data.kids.push {&amp;quot;name&amp;quot;:&amp;quot;Billy&amp;quot;, &amp;quot;age&amp;quot;:8}&lt;br /&gt;
data.kids.push {&amp;quot;name&amp;quot;:&amp;quot;Mary&amp;quot;, &amp;quot;age&amp;quot;:12}&lt;br /&gt;
&lt;br /&gt;
f = file.open(&amp;quot;data.json&amp;quot;)&lt;br /&gt;
f.write json.toJSON(data)&lt;br /&gt;
f.close&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The example below reads and parses the JSON file created above, then prints out the age of the first child.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;import &amp;quot;json&amp;quot;&lt;br /&gt;
&lt;br /&gt;
data = json.parse(file.open(&amp;quot;data.json&amp;quot;).read)&lt;br /&gt;
print data.kids[0].age&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Sys Modules]]&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:Command-Line_MiniScript]]&lt;/div&gt;</summary>
		<author><name>Redspark</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=ImportUtil&amp;diff=1393</id>
		<title>ImportUtil</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=ImportUtil&amp;diff=1393"/>
		<updated>2025-04-05T00:48:33Z</updated>

		<summary type="html">&lt;p&gt;Redspark: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This system module provides a single global function to help with importing other modules into larger programs.  See [[Import]] for more information.&lt;br /&gt;
&lt;br /&gt;
== Global Function ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| [[ensureImport|ensureImport]] || Imports a module into the global scope.  This ensures that the module is imported only once.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&amp;lt;ms&amp;gt;&lt;br /&gt;
  import &amp;quot;importUtil&amp;quot;&lt;br /&gt;
  ensureImport &amp;quot;events&amp;quot;&lt;br /&gt;
&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Sys Modules]]&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:Command-Line_MiniScript]]&lt;/div&gt;</summary>
		<author><name>Redspark</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=MathUtil&amp;diff=1392</id>
		<title>MathUtil</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=MathUtil&amp;diff=1392"/>
		<updated>2025-04-05T00:46:55Z</updated>

		<summary type="html">&lt;p&gt;Redspark: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In [[Mini Micro]], &amp;lt;c&amp;gt;mathUtil&amp;lt;/c&amp;gt; is an [[import]] module in the &amp;lt;c&amp;gt;/sys/lib&amp;lt;/c&amp;gt; directory.  It provides various additional math-related functions and constants.&lt;br /&gt;
&lt;br /&gt;
Like all the modules in &amp;lt;c&amp;gt;/sys/lib&amp;lt;/c&amp;gt;, the best documentation for mathUtil is the source code (&amp;lt;c&amp;gt;/sys/lib/mathUtil.ms&amp;lt;/c&amp;gt;) itself.  But this page summarizes the content in more concise form.&lt;br /&gt;
&lt;br /&gt;
== Constant ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Value / Purpose&lt;br /&gt;
|-&lt;br /&gt;
| mathUtil.e || [https://en.wikipedia.org/wiki/E_(mathematical_constant) Euler's number], roughly 2.718; base of natural logarithms&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
&lt;br /&gt;
The following methods are normally accessed via the &amp;lt;c&amp;gt;mathUtil&amp;lt;/c&amp;gt; prefix, e.g. &amp;lt;c&amp;gt;mathUtil.radToDeg(pi)&amp;lt;/c&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Method !! Returns&lt;br /&gt;
|-&lt;br /&gt;
| ln(''x'') || natural logarithm of ''x''&lt;br /&gt;
|-&lt;br /&gt;
| radToDeg(''radians'') || converts ''radians'' into degrees&lt;br /&gt;
|-&lt;br /&gt;
| degToRad(''degrees'') || converts ''degrees'' into radians&lt;br /&gt;
|-&lt;br /&gt;
| moveTowards(''num'', ''targetNum'', ''maxChange''=1) || returns a value closer to ''targetNum'' from ''num'', differing from ''num'' by no more than ''maxChange'')&lt;br /&gt;
|-&lt;br /&gt;
| moveTowardsXY(''mover'', ''target'', ''maxDist''=1) || like &amp;lt;c&amp;gt;moveTowards&amp;lt;/c&amp;gt;, but mutates map ''mover'' to approach ''target'', each with ''x'' and ''y'' properties (e.g., a [[Sprite]])&lt;br /&gt;
|-&lt;br /&gt;
| distance(''p1'', ''p2'') || find the distance between two points; each may be a map containing ''x'' and ''y', or an [''x'', ''y''] list&lt;br /&gt;
|-&lt;br /&gt;
| lerp(''a'', ''b'', ''t'') || returns a value some portion ''t'' of the way from ''a'' to ''b''&lt;br /&gt;
|-&lt;br /&gt;
| lerp2d(''p1'', ''p2'', ''t'') || same as &amp;lt;c&amp;gt;lerp&amp;lt;/c&amp;gt;, but on 2d points (maps or lists)&lt;br /&gt;
|-&lt;br /&gt;
| proportionAlongLine(''endA'', ''endB'', ''p'') || returns how far ''p'' is along the line from ''endA'' to ''endB''&lt;br /&gt;
|-&lt;br /&gt;
| nearestPointOnLine(''endA'', ''endB'', ''p'') || returns closest point to ''p'' on the line from ''endA'' to ''endB'' as an [''x'', ''y''] list&lt;br /&gt;
|-&lt;br /&gt;
| nearestPointOnLineSegment(''endA'', ''endB'', ''p'') || same as &amp;lt;c&amp;gt;nearestPointOnLine&amp;lt;/c&amp;gt;, but limited to not go beyond the range from ''endA'' to ''endB''&lt;br /&gt;
|-&lt;br /&gt;
| distanceToLine(''endA'', ''endB'', ''p'') || returns distance from ''p'' to the line from ''endA'' to ''endB''&lt;br /&gt;
|-&lt;br /&gt;
| distanceToLineSegment(''endA'', ''endB'', ''p'') || same as &amp;lt;c&amp;gt;distanceToLine&amp;lt;/c&amp;gt;, but limited to not go beyond the range from ''endA'' to ''endB''&lt;br /&gt;
|-&lt;br /&gt;
| polyPerimeter(''polygon'') || returns total distance around ''polygon'' (given as list of [''x'', ''y'']] points)&lt;br /&gt;
|-&lt;br /&gt;
| polyArea(''polygon'') || returns area of ''polygon'' (given as list of [''x'', ''y'']] points)&lt;br /&gt;
|-&lt;br /&gt;
| pointInPoly(''point'', ''polygon'') || returns true if ''point'' (an [''x'', ''y''] point) is contained within ''polygon''; or if ''point'' is a list of ['x'', ''y''] points, returns true if any of those points are within ''polygon''&lt;br /&gt;
|-&lt;br /&gt;
| offsetPoly(''polygon'', ''delta'') || returns a new polygon by insetting/growing ''polygon'' by the given amount&lt;br /&gt;
|-&lt;br /&gt;
| shiftPoly(''polygon'', ''dx'', ''dy'') || returns a new polygon by translating ''polygon'' by the given amounts&lt;br /&gt;
|-&lt;br /&gt;
| rotatePoly(''polygon'', ''degrees'') || returns a new polygon by rotating ''polygon'' by ''degrees'' clockwise&lt;br /&gt;
|-&lt;br /&gt;
| randNormal(''mean''=0, ''stddev''=1) || returns a [https://en.wikipedia.org/wiki/Normal_distribution normally-distributed] random number&lt;br /&gt;
|-&lt;br /&gt;
| randRange(''min'', ''max'') || returns a random number between ''min'' and ''max''&lt;br /&gt;
|-&lt;br /&gt;
| dice(''numberOfDice''=1, ''sides''=6) || roll ''numberOfDice'' dice, each with values from 1 to ''sides'', and return the sum&lt;br /&gt;
|-&lt;br /&gt;
| clamp(''x'', ''minval''=0, ''maxval'=1) || return ''x'' limited to the range ''minval'' to ''maxval''&lt;br /&gt;
|-&lt;br /&gt;
| numToStr(''n'', ''precision'') || convert ''n'' to a string, with a specified number of digits past the decimal place, with trailing zeros&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
The following program creates a sprite, then uses &amp;lt;c&amp;gt;mathUtil.moveTowardsXY&amp;lt;/c&amp;gt; to make it chase the mouse.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;import &amp;quot;mathUtil&amp;quot;&lt;br /&gt;
s = new Sprite&lt;br /&gt;
s.image = file.loadImage(&amp;quot;/sys/pics/Wumpus.png&amp;quot;)&lt;br /&gt;
display(4).sprites.push s&lt;br /&gt;
while true&lt;br /&gt;
	mathUtil.moveTowardsXY s, mouse, 10&lt;br /&gt;
	yield&lt;br /&gt;
end while&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Sys Modules]]&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:Command-Line_MiniScript]]&lt;/div&gt;</summary>
		<author><name>Redspark</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=MatrixUtil&amp;diff=1390</id>
		<title>MatrixUtil</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=MatrixUtil&amp;diff=1390"/>
		<updated>2025-04-01T02:53:05Z</updated>

		<summary type="html">&lt;p&gt;Redspark: Initial Page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This system module defines the Matrix class. A matrix is a 2D array of numbers.  These have lots of uses in computer graphics. In keeping with standard programming convention, but NOT standard math convention, we use 0-base indexing.  So the top-left element is 0,0.&lt;br /&gt;
&lt;br /&gt;
== Class ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Header text !! Header text&lt;br /&gt;
|-&lt;br /&gt;
|[[matrixUtil.Matrix|Matrix]] || Defines a Matrix class in global namespace.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:Sys Modules]]&lt;/div&gt;</summary>
		<author><name>Redspark</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Json&amp;diff=1389</id>
		<title>Json</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Json&amp;diff=1389"/>
		<updated>2025-03-31T17:24:12Z</updated>

		<summary type="html">&lt;p&gt;Redspark: Added to Sys Modules Category&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In [[Mini Micro]], &amp;lt;c&amp;gt;json&amp;lt;/c&amp;gt; is an [[import]] module in the &amp;lt;c&amp;gt;/sys/lib&amp;lt;/c&amp;gt; directory.  It provides conversion of MiniScript values to and from [https://www.json.org/ JSON] format, as well as some related utility functions.&lt;br /&gt;
&lt;br /&gt;
Like all the modules in &amp;lt;c&amp;gt;/sys/lib&amp;lt;/c&amp;gt;, the best documentation for the json module is the source code (&amp;lt;c&amp;gt;/sys/lib/json.ms&amp;lt;/c&amp;gt;) itself.  But this page summarizes the content in more concise form.&lt;br /&gt;
&lt;br /&gt;
== Functions ==&lt;br /&gt;
&lt;br /&gt;
After [[import|importing]] &amp;quot;json&amp;quot;, the following methods may be accessed under the &amp;lt;c&amp;gt;json&amp;lt;/c&amp;gt; map (e.g. as &amp;lt;c&amp;gt;json.parse&amp;lt;/c&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Method !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| parse(''jsonString'') || parses JSON data into native MiniScript values&lt;br /&gt;
|-&lt;br /&gt;
| toJSON(''value'', ''compact''=false, ''indent''=0) || converts MiniScript values into JSON format&lt;br /&gt;
|-&lt;br /&gt;
| hexToInt(''s'') || convert hexadecimal string (e.g. &amp;quot;002A&amp;quot;) to the equivalent number (42)&lt;br /&gt;
|-&lt;br /&gt;
| escape(''s'') || change special characters into backslash sequences&lt;br /&gt;
|-&lt;br /&gt;
| unescape(''s'') || replace backslash sequences with normal characters&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
The following example builds a simple MiniScript data structure, then writes this out to a file in JSON format.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;import &amp;quot;json&amp;quot;&lt;br /&gt;
&lt;br /&gt;
data = {&amp;quot;name&amp;quot;:&amp;quot;Alice&amp;quot;, &amp;quot;job&amp;quot;:&amp;quot;Engineer&amp;quot;}&lt;br /&gt;
data.kids = []&lt;br /&gt;
data.kids.push {&amp;quot;name&amp;quot;:&amp;quot;Billy&amp;quot;, &amp;quot;age&amp;quot;:8}&lt;br /&gt;
data.kids.push {&amp;quot;name&amp;quot;:&amp;quot;Mary&amp;quot;, &amp;quot;age&amp;quot;:12}&lt;br /&gt;
&lt;br /&gt;
f = file.open(&amp;quot;data.json&amp;quot;)&lt;br /&gt;
f.write json.toJSON(data)&lt;br /&gt;
f.close&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The example below reads and parses the JSON file created above, then prints out the age of the first child.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;import &amp;quot;json&amp;quot;&lt;br /&gt;
&lt;br /&gt;
data = json.parse(file.open(&amp;quot;data.json&amp;quot;).read)&lt;br /&gt;
print data.kids[0].age&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:Sys Modules]]&lt;/div&gt;</summary>
		<author><name>Redspark</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=ImportUtil&amp;diff=1388</id>
		<title>ImportUtil</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=ImportUtil&amp;diff=1388"/>
		<updated>2025-03-31T17:20:51Z</updated>

		<summary type="html">&lt;p&gt;Redspark: Initial Page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This system module provides a single global function to help with importing other modules into larger programs.  See [[Import]] for more information.&lt;br /&gt;
&lt;br /&gt;
== Global Function ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| [[ensureImport|ensureImport]] || Imports a module into the global scope.  This ensures that the module is imported only once.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&amp;lt;ms&amp;gt;&lt;br /&gt;
  import &amp;quot;importUtil&amp;quot;&lt;br /&gt;
  ensureImport &amp;quot;events&amp;quot;&lt;br /&gt;
&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:Sys Modules]]&lt;/div&gt;</summary>
		<author><name>Redspark</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=MathUtil&amp;diff=1387</id>
		<title>MathUtil</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=MathUtil&amp;diff=1387"/>
		<updated>2025-03-31T16:09:39Z</updated>

		<summary type="html">&lt;p&gt;Redspark: Added to Sys Modules Category&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In [[Mini Micro]], &amp;lt;c&amp;gt;mathUtil&amp;lt;/c&amp;gt; is an [[import]] module in the &amp;lt;c&amp;gt;/sys/lib&amp;lt;/c&amp;gt; directory.  It provides various additional math-related functions and constants.&lt;br /&gt;
&lt;br /&gt;
Like all the modules in &amp;lt;c&amp;gt;/sys/lib&amp;lt;/c&amp;gt;, the best documentation for mathUtil is the source code (&amp;lt;c&amp;gt;/sys/lib/mathUtil.ms&amp;lt;/c&amp;gt;) itself.  But this page summarizes the content in more concise form.&lt;br /&gt;
&lt;br /&gt;
== Constant ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Value / Purpose&lt;br /&gt;
|-&lt;br /&gt;
| mathUtil.e || [https://en.wikipedia.org/wiki/E_(mathematical_constant) Euler's number], roughly 2.718; base of natural logarithms&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
&lt;br /&gt;
The following methods are normally accessed via the &amp;lt;c&amp;gt;mathUtil&amp;lt;/c&amp;gt; prefix, e.g. &amp;lt;c&amp;gt;mathUtil.radToDeg(pi)&amp;lt;/c&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Method !! Returns&lt;br /&gt;
|-&lt;br /&gt;
| ln(''x'') || natural logarithm of ''x''&lt;br /&gt;
|-&lt;br /&gt;
| radToDeg(''radians'') || converts ''radians'' into degrees&lt;br /&gt;
|-&lt;br /&gt;
| degToRad(''radians'') || converts ''degrees'' into radians&lt;br /&gt;
|-&lt;br /&gt;
| moveTowards(''num'', ''targetNum'', ''maxChange''=1) || returns a value closer to ''targetNum'' from ''num'', differing from ''num'' by no more than ''maxChange'')&lt;br /&gt;
|-&lt;br /&gt;
| moveTowardsXY(''mover'', ''target'', ''maxDist''=1) || like &amp;lt;c&amp;gt;moveTowards&amp;lt;/c&amp;gt;, but mutates map ''mover'' to approach ''target'', each with ''x'' and ''y'' properties (e.g., a [[Sprite]])&lt;br /&gt;
|-&lt;br /&gt;
| distance(''p1'', ''p2'') || find the distance between two points; each may be a map containing ''x'' and ''y', or an [''x'', ''y''] list&lt;br /&gt;
|-&lt;br /&gt;
| lerp(''a'', ''b'', ''t'') || returns a value some portion ''t'' of the way from ''a'' to ''b''&lt;br /&gt;
|-&lt;br /&gt;
| lerp2d(''p1'', ''p2'', ''t'') || same as &amp;lt;c&amp;gt;lerp&amp;lt;/c&amp;gt;, but on 2d points (maps or lists)&lt;br /&gt;
|-&lt;br /&gt;
| proportionAlongLine(''endA'', ''endB'', ''p'') || returns how far ''p'' is along the line from ''endA'' to ''endB''&lt;br /&gt;
|-&lt;br /&gt;
| nearestPointOnLine(''endA'', ''endB'', ''p'') || returns closest point to ''p'' on the line from ''endA'' to ''endB'' as an [''x'', ''y''] list&lt;br /&gt;
|-&lt;br /&gt;
| nearestPointOnLineSegment(''endA'', ''endB'', ''p'') || same as &amp;lt;c&amp;gt;nearestPointOnLine&amp;lt;/c&amp;gt;, but limited to not go beyond the range from ''endA'' to ''endB''&lt;br /&gt;
|-&lt;br /&gt;
| distanceToLine(''endA'', ''endB'', ''p'') || returns distance from ''p'' to the line from ''endA'' to ''endB''&lt;br /&gt;
|-&lt;br /&gt;
| distanceToLineSegment(''endA'', ''endB'', ''p'') || same as &amp;lt;c&amp;gt;distanceToLine&amp;lt;/c&amp;gt;, but limited to not go beyond the range from ''endA'' to ''endB''&lt;br /&gt;
|-&lt;br /&gt;
| polyPerimeter(''polygon'') || returns total distance around ''polygon'' (given as list of [''x'', ''y'']] points)&lt;br /&gt;
|-&lt;br /&gt;
| polyArea(''polygon'') || returns area of ''polygon'' (given as list of [''x'', ''y'']] points)&lt;br /&gt;
|-&lt;br /&gt;
| pointInPoly(''point'', ''polygon'') || returns true if ''point'' (an [''x'', ''y''] point) is contained within ''polygon''; or if ''point'' is a list of ['x'', ''y''] points, returns true if any of those points are within ''polygon''&lt;br /&gt;
|-&lt;br /&gt;
| offsetPoly(''polygon'', ''delta'') || returns a new polygon by insetting/growing ''polygon'' by the given amount&lt;br /&gt;
|-&lt;br /&gt;
| shiftPoly(''polygon'', ''dx'', ''dy'') || returns a new polygon by translating ''polygon'' by the given amounts&lt;br /&gt;
|-&lt;br /&gt;
| rotatePoly(''polygon'', ''degrees'') || returns a new polygon by rotating ''polygon'' by ''degrees'' clockwise&lt;br /&gt;
|-&lt;br /&gt;
| randNormal(''mean''=0, ''stddev''=1) || returns a [https://en.wikipedia.org/wiki/Normal_distribution normally-distributed] random number&lt;br /&gt;
|-&lt;br /&gt;
| randRange(''min'', ''max'') || returns a random number between ''min'' and ''max''&lt;br /&gt;
|-&lt;br /&gt;
| dice(''numberOfDice''=1, ''sides''=6) || roll ''numberOfDice'' dice, each with values from 1 to ''sides'', and return the sum&lt;br /&gt;
|-&lt;br /&gt;
| clamp(''x'', ''minval''=0, ''maxval'=1) || return ''x'' limited to the range ''minval'' to ''maxval''&lt;br /&gt;
|-&lt;br /&gt;
| numToStr(''n'', ''precision'') || convert ''n'' to a string, with a specified number of digits past the decimal place, with trailing zeros&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
The following program creates a sprite, then uses &amp;lt;c&amp;gt;mathUtil.moveTowardsXY&amp;lt;/c&amp;gt; to make it chase the mouse.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;import &amp;quot;mathUtil&amp;quot;&lt;br /&gt;
s = new Sprite&lt;br /&gt;
s.image = file.loadImage(&amp;quot;/sys/pics/Wumpus.png&amp;quot;)&lt;br /&gt;
display(4).sprites.push s&lt;br /&gt;
while true&lt;br /&gt;
	mathUtil.moveTowardsXY s, mouse, 10&lt;br /&gt;
	yield&lt;br /&gt;
end while&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:Sys Modules]]&lt;/div&gt;</summary>
		<author><name>Redspark</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=MapUtil&amp;diff=1386</id>
		<title>MapUtil</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=MapUtil&amp;diff=1386"/>
		<updated>2025-03-31T16:07:52Z</updated>

		<summary type="html">&lt;p&gt;Redspark: Added to Sys Modules Category&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In [[Mini Micro]], &amp;lt;c&amp;gt;mapUtil&amp;lt;/c&amp;gt; is an [[import]] module in the &amp;lt;c&amp;gt;/sys/lib&amp;lt;/c&amp;gt; directory.  It provides various additional [[map]]-related functions, directly extending the [[map]] datatype.&lt;br /&gt;
&lt;br /&gt;
Like all the modules in &amp;lt;c&amp;gt;/sys/lib&amp;lt;/c&amp;gt;, the best documentation for mapUtil is the source code (&amp;lt;c&amp;gt;/sys/lib/mapUtil.ms&amp;lt;/c&amp;gt;) itself.  But this page summarizes the content in more concise form.&lt;br /&gt;
&lt;br /&gt;
=== Constants ===&lt;br /&gt;
The following values should be normally be prefixed with &amp;lt;c&amp;gt;mapUtil&amp;lt;/c&amp;gt;, e.g., &amp;lt;c&amp;gt;mapUtil.fromTo&amp;lt;/c&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Value / Purpose&lt;br /&gt;
|-&lt;br /&gt;
| fromTo || generate a map from one sequence (list or string) to another.  The two sequences must be the same length.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Added map methods ===&lt;br /&gt;
The following methods are added to the [[map]] type, and so are accessed using dot syntax after any map, for example: &amp;lt;c&amp;gt;{&amp;quot;Hello&amp;quot;: &amp;quot;World&amp;quot;}.inverse&amp;lt;/c&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Method !! Returns&lt;br /&gt;
|-&lt;br /&gt;
| get(''key'', ''defaultValue=null'') || look up the value for an index in this map, but if the given index is not found, return a default value instead. Works with inherited values, too.&lt;br /&gt;
|-&lt;br /&gt;
| hasValue(''v'', ''includeInherited=false'') || return true if this map contains the given value as a value (compare with built-in function .hasIndex, which checks whether this map has a given value as a key).  By default this&lt;br /&gt;
does not walk the inheritance chain (just like .hasIndex), but&lt;br /&gt;
if you pass ''true'' as the second parameter, then it does.&lt;br /&gt;
|-&lt;br /&gt;
| sortedIndexes || get the indexes of this map, but in sorted order (rather than undefined order as .indexes gives you).&lt;br /&gt;
|-&lt;br /&gt;
| inverse || return a new map that has the keys and values swapped (keys of this map become values of the result map, and vice versa).&lt;br /&gt;
|- &lt;br /&gt;
| filterIndexes(''func'') || remove any indexes for which the given function does not return true.&lt;br /&gt;
|-&lt;br /&gt;
| filterValues(''func'') || remove any key/value pairs for which the function, applied to the value, does not return true.&lt;br /&gt;
|-&lt;br /&gt;
| applyToValues(''func'') || apply the given function to all values.&lt;br /&gt;
|-&lt;br /&gt;
| pairs || get all key/value pairs as a list (in arbitrary order) of little maps with &amp;quot;key&amp;quot; and &amp;quot;value&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
| swap(''key1'', ''key2'') || swap the values of two keys.  Note that this may be applied to locals (or globals), enabling you to swap the values of two variables.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;import &amp;quot;mapUtil&amp;quot;&lt;br /&gt;
print {&amp;quot;Hello&amp;quot;: &amp;quot;World&amp;quot;}.inverse //prints {&amp;quot;World&amp;quot;: &amp;quot;Hello&amp;quot;}&lt;br /&gt;
&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:Sys Modules]]&lt;/div&gt;</summary>
		<author><name>Redspark</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=StringUtil&amp;diff=1385</id>
		<title>StringUtil</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=StringUtil&amp;diff=1385"/>
		<updated>2025-03-31T16:07:24Z</updated>

		<summary type="html">&lt;p&gt;Redspark: Added to Sys Modules Category&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In [[Mini Micro]], &amp;lt;c&amp;gt;stringUtil&amp;lt;/c&amp;gt; is an [[import]] module in the &amp;lt;c&amp;gt;/sys/lib&amp;lt;/c&amp;gt; directory.  It provides various additional [[string]]-related functions, directly extending the [[string]] datatype.&lt;br /&gt;
&lt;br /&gt;
Like all the modules in &amp;lt;c&amp;gt;/sys/lib&amp;lt;/c&amp;gt;, the best documentation for stringUtil is the source code (&amp;lt;c&amp;gt;/sys/lib/stringUtil.ms&amp;lt;/c&amp;gt;) itself.  But this page summarizes the content in more concise form.&lt;br /&gt;
&lt;br /&gt;
== Constants ==&lt;br /&gt;
&lt;br /&gt;
The following values should be normally be prefixed with &amp;lt;c&amp;gt;stringUtil&amp;lt;/c&amp;gt;, e.g., &amp;lt;c&amp;gt;stringUtil.smallWords&amp;lt;/c&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Value / Purpose&lt;br /&gt;
|-&lt;br /&gt;
| smallWords || list of words that should not be capitalized in a title, except as the first word&lt;br /&gt;
|-&lt;br /&gt;
| TAB || &amp;lt;c&amp;gt;char(9)&amp;lt;/c&amp;gt;; tab character (advances to the next multiple of 4 spaces)&lt;br /&gt;
|-&lt;br /&gt;
| CR || &amp;lt;c&amp;gt;char(13)&amp;lt;/c&amp;gt;; carriage return (moves the cursor to the start of the next line)&lt;br /&gt;
|-&lt;br /&gt;
| LF || &amp;lt;c&amp;gt;char(10)&amp;lt;/c&amp;gt;; line feed (alternate line ending used in some files)&lt;br /&gt;
|-&lt;br /&gt;
| whitespace || common whitespace characters: space, TAB, CR, and LF&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Added string methods ==&lt;br /&gt;
&lt;br /&gt;
The following methods are added to the [[string]] type, and so are accessed using dot syntax after any string, for example: &amp;lt;c&amp;gt;&amp;quot;hello world&amp;quot;.titleCase&amp;lt;/c&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that because [[string]]s are immutable, none of these methods change the string they are called on; instead they return a new string (where applicable).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Method !! Returns&lt;br /&gt;
|-&lt;br /&gt;
| capitalized || capitalizes the first letter of the string&lt;br /&gt;
|-&lt;br /&gt;
| titleCase || capitalizes each word, except for small words&lt;br /&gt;
|-&lt;br /&gt;
| startsWith(''s'') || returns true if this string begins with ''s''&lt;br /&gt;
|-&lt;br /&gt;
| endsWith(''s'') || returns true if this string ends with ''s''&lt;br /&gt;
|-&lt;br /&gt;
| contains(''s'') || returns true if this string contains ''s''&lt;br /&gt;
|-&lt;br /&gt;
| pad(''length'', ''padChar''=&amp;quot; &amp;quot;, ''cutIfTooLong''=true) || pads a string by appending the given pad char, optionally cutting it if too long&lt;br /&gt;
|-&lt;br /&gt;
| trim(''charsToRemove''=whitespace) || trims the given set of characters off both ends of the string&lt;br /&gt;
|-&lt;br /&gt;
| trimRight(''charsToRemove''=whitespace) || trims the given set of characters off the end of the string&lt;br /&gt;
|-&lt;br /&gt;
| trimLeft(''charsToRemove''=whitespace) || trims the given set of characters off the start of the string&lt;br /&gt;
|-&lt;br /&gt;
| ellideEnd(''maxLength''=10) || shortens a string and appends an ellipsis if the string is too long&lt;br /&gt;
|-&lt;br /&gt;
| ellideMiddle(''maxLength''=10) || shortens a string in the middle, inserting an ellipsis&lt;br /&gt;
|-&lt;br /&gt;
| reverse || reverses the string (e.g. Hello -&amp;gt; olleH)&lt;br /&gt;
|-&lt;br /&gt;
| splitLines || splits a string into lines by CR, LF, or CR+LF&lt;br /&gt;
|-&lt;br /&gt;
| wrap(''width''=67) || splits the string on spaces so that each line fits within the given width&lt;br /&gt;
|-&lt;br /&gt;
| cipher(charMap) || applies a substitution cipher, using the given character map&lt;br /&gt;
|-&lt;br /&gt;
| rot13 || applies the classic [https://en.wikipedia.org/wiki/ROT13 ROT-13] substitution cipher&lt;br /&gt;
|-&lt;br /&gt;
| editDistance = function(''s2'') || returns how many 1-character edits needed to transform this string into ''s2''&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;import &amp;quot;stringUtil&amp;quot;&lt;br /&gt;
print &amp;quot;hello world&amp;quot;.titleCase.reverse  // prints: dlroW olleH&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:Sys Modules]]&lt;/div&gt;</summary>
		<author><name>Redspark</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=ListUtil&amp;diff=1384</id>
		<title>ListUtil</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=ListUtil&amp;diff=1384"/>
		<updated>2025-03-31T16:06:40Z</updated>

		<summary type="html">&lt;p&gt;Redspark: Added to Sys Modules Category&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In [[Mini Micro]], &amp;lt;c&amp;gt;listUtil&amp;lt;/c&amp;gt; is an [[import]] module in the &amp;lt;c&amp;gt;/sys/lib&amp;lt;/c&amp;gt; directory.  It provides various additional [[list]]-related functions, many of them directly extending the [[list]] datatype.&lt;br /&gt;
&lt;br /&gt;
Like all the modules in &amp;lt;c&amp;gt;/sys/lib&amp;lt;/c&amp;gt;, the best documentation for listUtil is the source code (&amp;lt;c&amp;gt;/sys/lib/listUtil.ms&amp;lt;/c&amp;gt;) itself.  But this page summarizes the content in more concise form.&lt;br /&gt;
&lt;br /&gt;
== Added list methods ==&lt;br /&gt;
&lt;br /&gt;
The following methods are added to the [[list]] type, and so are accessed using dot syntax after any list, for example: &amp;lt;c&amp;gt;[1, 2, 3].reverse&amp;lt;/c&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some of these methods mutate (modify) the list you call it on; others return a new list.  See below, or the header comments in the source code, for details.  Note that this is different from [[stringUtil]], where all methods return a new string (since [[string]]s are immutable).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Method !! Returns&lt;br /&gt;
|-&lt;br /&gt;
| contains(''item'') || true if this list contains the given ''item''&lt;br /&gt;
|-&lt;br /&gt;
| deepCopy || returns a clone of this list, recursively cloning any sub-lists as well&lt;br /&gt;
|-&lt;br /&gt;
| add(''addend'') || mutates this list by adding elements of another list of the same size, or by adding ''addend'' to all elements&lt;br /&gt;
|-&lt;br /&gt;
| plus(''addend'') || same as &amp;lt;c&amp;gt;add&amp;lt;/c&amp;gt;, but returns a new list, leaving this list unchanged&lt;br /&gt;
|-&lt;br /&gt;
| multiplyBy(''factor'') || mutates this list by multiplying elements of another list of the same size, or by multiplying all elements by ''factor''&lt;br /&gt;
|-&lt;br /&gt;
| times(''addend'') || same as &amp;lt;c&amp;gt;multiplyBy&amp;lt;/c&amp;gt;, but returns a new list, leaving this list unchanged&lt;br /&gt;
|-&lt;br /&gt;
| dot(''other'') || returns sum of pairwise products of elements in this list and ''other''&lt;br /&gt;
|-&lt;br /&gt;
| reverse || mutates this list by reversing the order of its elements&lt;br /&gt;
|-&lt;br /&gt;
| reversed || returns a new list containing the elements of this one in reverse order, leaving this list unchanged&lt;br /&gt;
|-&lt;br /&gt;
| apply(''func'') || mutates this list by applying a function to every element, in place&lt;br /&gt;
|-&lt;br /&gt;
| apply1(''func'', ''arg'') || same as &amp;lt;c&amp;gt;apply&amp;lt;/c&amp;gt;, but takes one extra argument&lt;br /&gt;
|-&lt;br /&gt;
| mean || returns the average (sum divided by number of values) of this list&lt;br /&gt;
|-&lt;br /&gt;
| counts || returns a map that maps each unique element of this list, to the number of times that value occurs&lt;br /&gt;
|-&lt;br /&gt;
| distinct || returns a list of the unique values in this list (in arbitrary order)&lt;br /&gt;
|-&lt;br /&gt;
| product || returns the result of multiplying together all the elements in this list&lt;br /&gt;
|-&lt;br /&gt;
| min || returns the minimum value in this list&lt;br /&gt;
|-&lt;br /&gt;
| max || returns the maximum value in this list&lt;br /&gt;
|-&lt;br /&gt;
| reduce(''func'') || reduce the list to a single value by applying ''func'' to two values at a time&lt;br /&gt;
|-&lt;br /&gt;
| filter(''func'') || mutates this list by removing all elements ''x'' where ''func(x)'' is not true;&lt;br /&gt;
or where ''x.func'' is not true (if ''func'' is actually a string)&lt;br /&gt;
|-&lt;br /&gt;
| filtered(''func'') || same as ''filter'', but returns a new list, leaving this list unchanged&lt;br /&gt;
|-&lt;br /&gt;
| valuesOf(''indexToExtract'') || returns a list containing ''elem[indexToExtract]'' for every element ''elem''&lt;br /&gt;
|-&lt;br /&gt;
| removeVal(''val'', ''removeAll''=false) || mutates this list, removing the first (or all) occurrence of ''val''&lt;br /&gt;
|-&lt;br /&gt;
| any || returns a random element of this list&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Factory methods ==&lt;br /&gt;
&lt;br /&gt;
The following methods are also added to the [[list]] type, but are meant to be called as &amp;lt;c&amp;gt;list.init&amp;lt;/c&amp;gt;, &amp;lt;c&amp;gt;list.init2d&amp;lt;/c&amp;gt;, and &amp;lt;c&amp;gt;list.init3d&amp;lt;/c&amp;gt; rather than being called on an existing list.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Method !! Returns&lt;br /&gt;
|-&lt;br /&gt;
| init(''size'', ''initialValue'') || list containing ''size'' elements with value ''initialValue''&lt;br /&gt;
|-&lt;br /&gt;
| init2d(''rows'', ''columns'', ''initialValue'') || 2D array containing ''rows'' rows, each with ''columns'' elements with value ''initialValue''&lt;br /&gt;
|-&lt;br /&gt;
| init3d(''sizeA'', ''sizeB'', ''sizeC'', ''initialValue'') || 3D array containing ''sizeA'' 2D arrays&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
See also: [[matrixUtil]]&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;import &amp;quot;listUtil&amp;quot;&lt;br /&gt;
print [1, 2, 3].reversed  // prints: [3, 2, 1]&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:Sys Modules]]&lt;/div&gt;</summary>
		<author><name>Redspark</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=GUI&amp;diff=1383</id>
		<title>GUI</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=GUI&amp;diff=1383"/>
		<updated>2025-03-31T15:38:46Z</updated>

		<summary type="html">&lt;p&gt;Redspark: Initial Page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This module provides classes and utilities for making GUI (Graphical User Interface) apps, like the desktop demo.&lt;br /&gt;
&lt;br /&gt;
== Classes ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| [[gui.Image9Slice|Image9Slice]] || An image wrapper with margins that are not stretched, and a middle that is stretched when drawn to any size.&lt;br /&gt;
|-&lt;br /&gt;
| [[gui.Scrollbar|Scrollbar]] || Base class for other scrollbar classes.&lt;br /&gt;
|-&lt;br /&gt;
| [[gui.ScrollbarH| ScrollbarH]] || Horizontal Scrollbar&lt;br /&gt;
|-&lt;br /&gt;
| [[gui.ScrollbarV|ScrollbarV]] || Vertical Scrollbar&lt;br /&gt;
|-&lt;br /&gt;
| [[gui.Window|Window]] || Window class inherits from the [[events.EventSprite]] class&lt;br /&gt;
|-&lt;br /&gt;
| [[gui.Menubar|Menubar]] || Represents a group of Menus drawn horizontally as a single unit.&lt;br /&gt;
|-&lt;br /&gt;
| [[gui.Menu|Menu]] || Represents a group of MenuItems as a menu or submenu.&lt;br /&gt;
|-&lt;br /&gt;
| [[gui.MenuItem|MenuItem]] || Represents a single item within a menu.&lt;br /&gt;
|-&lt;br /&gt;
| [[gui.InputField|InputField]] || Numeric input field.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Functions ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| [[gui.clearScratch|clearScratch(width=256, height=256, color=&amp;quot;#FFFFFF&amp;quot;)]] || Clear our off-screen &amp;quot;scratch&amp;quot; display, used for drawing or compositing things to create an image or sprite).&lt;br /&gt;
|-&lt;br /&gt;
| [[gui.drawMenuItem|drawMenuItem(g, menuText, left, bottom, width=100, highlighted=false, disabled=false)]] || Draw a single menu item.&lt;br /&gt;
|-&lt;br /&gt;
| [[gui.drawMenuItem|drawMenuItem(g, menuText, left, bottom, width=100, highlighted=false, disabled=false)]] || A helper function for drawMenuItem.&lt;br /&gt;
|-&lt;br /&gt;
| [[gui.calcMenuItemWidth|calcMenuItemWidth(menuText)]] || Calculates the menu item text width in pixels plus padding.&lt;br /&gt;
|-&lt;br /&gt;
| [[gui.calcMenuItemWidth| drawMenuBottom(g, left, menuBottom, width=100)]] || Draws the bottom of the menu.  Note that the third parameter is the bottom of the bottommost menu item; we actually draw below that (border and shadow).&lt;br /&gt;
|-&lt;br /&gt;
| [[gui.setupDisplays|setupDisplays]] || Setups up the display layers.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Properties ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| gfxSource || An image template used to draw certain GUI controls.  See /sys/data/desktop/desktopGfx.png for an example.&lt;br /&gt;
|-&lt;br /&gt;
| smallFont || A bmfFont.  If /usr/fonts/minimicro-pro-12.bmf does not exist, then /sys/fonts/minimicro-pro-12.bmf is used.&lt;br /&gt;
|-&lt;br /&gt;
| medFont || A bmfFont.  If /usr/fonts/minimicro-pro-16.bmf does not exist, then /sys/fonts/minimicro-pro-16.bmf is used.&lt;br /&gt;
|-&lt;br /&gt;
| largeFont || A bmfFont.  If /usr/fonts/minimicro-pro-20.bmf does not exist, then /sys/fonts/minimicro-pro-20.bmf is used.&lt;br /&gt;
|-&lt;br /&gt;
| images || A map of various control images pulled from the gfxSource image.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Constants ==&lt;br /&gt;
&lt;br /&gt;
=== Window.dragMode ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| kDragMove || Moving the window&lt;br /&gt;
|-&lt;br /&gt;
| kDragResize || Stretching the window&lt;br /&gt;
|-&lt;br /&gt;
| kDragSelect || Selecting stuff within the window&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Window.partHit ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| kPartTitle || Title bar&lt;br /&gt;
|-&lt;br /&gt;
| kPartFrame || Frame&lt;br /&gt;
|-&lt;br /&gt;
| kPartResize || Resize grip box&lt;br /&gt;
|-&lt;br /&gt;
| kPartContent || Content area&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Drawing ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| kScrollbarSize || Default thickness for any scrollbar&lt;br /&gt;
|-&lt;br /&gt;
| kMenuBarHeight || Height of the menu bar at top of screen&lt;br /&gt;
|-&lt;br /&gt;
| kMenuItemHeight || Height of one item in a menu&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Misc. ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| selectionColor || Color string&lt;br /&gt;
|-&lt;br /&gt;
| scrollWheelSpeed || Distance to scroll when mouse wheel is turned&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:Sys Modules]]&lt;/div&gt;</summary>
		<author><name>Redspark</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Grfon&amp;diff=1382</id>
		<title>Grfon</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Grfon&amp;diff=1382"/>
		<updated>2025-03-31T14:23:03Z</updated>

		<summary type="html">&lt;p&gt;Redspark: Initial Page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;GRFON is a simpler and gentler file format compared to JSON and was designed to be especially human-editable.  For information on the GRFON file specification, see:  https://github.com/JoeStrout/grfon/blob/main/docs/README.md&lt;br /&gt;
&lt;br /&gt;
== Functions ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| [[grfon.parse|parse(string)]] || convert a GRFON string into a MiniScript value (which could include a list or map of other values).  This is the main entry point for reading GRFON data and converting it to native form.&lt;br /&gt;
|-&lt;br /&gt;
| [[grfon.escape|escape(string)]]  || Escape any special characters in the given string by preceding them with backslashes.&lt;br /&gt;
|-&lt;br /&gt;
| [[grfon.unescape|unescape(string)]] || Replaces backslash sequences in the given string with the appropriate character.&lt;br /&gt;
|-&lt;br /&gt;
| [[grfon.toGRFON| toGRFON((value, compact=false, indent=0, topLevel=true)]] || Converts a value to GRFON syntax.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Properties ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| interpretTrueAndFalse || Flag to control whether strings &amp;quot;true&amp;quot; and &amp;quot;false&amp;quot; should be returned as 1 or 0, or left as strings.&lt;br /&gt;
|-&lt;br /&gt;
| interpretNull || Similar flag for string &amp;quot;null&amp;quot;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Examples ===&lt;br /&gt;
&amp;lt;ms&amp;gt;&lt;br /&gt;
s = toGRFON([1, 2, &amp;quot;foo&amp;quot;], true)&lt;br /&gt;
&amp;lt;/ms&amp;gt;&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:Sys Modules]]&lt;/div&gt;</summary>
		<author><name>Redspark</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=DateTime&amp;diff=1381</id>
		<title>DateTime</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=DateTime&amp;diff=1381"/>
		<updated>2025-03-31T07:44:20Z</updated>

		<summary type="html">&lt;p&gt;Redspark: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Mini Micro supports dates/times in two different formats: as a string (by default in SQL format), and as a number of seconds since a reference date (Jan 01, 2000).  The numeric format is useful for doing date/time calculations, like finding the amount of time between two dates, or adding some amount of time to a starting date/time.&lt;br /&gt;
&lt;br /&gt;
For details on the format specifiers: https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings .&lt;br /&gt;
&lt;br /&gt;
== Functions ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| [[dateTime.nowVal|nowVal]] || Get the current date/time, as a number.&lt;br /&gt;
|-&lt;br /&gt;
| [[dateTime.now|now(format)]] || Return the current date/time as a string. By default, format = &amp;quot;yyyy-MM-dd HH:mm:ss&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
| [[dateTime.str|str(date, format)]] || Convert a date (string or number) to a string with the given format. By default, format = &amp;quot;yyyy-MM-dd HH:mm:ss&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
| [[dateTime.val|val(dateStr)]] || Convert a date string to a number. By default, format = &amp;quot;yyyy-MM-dd HH:mm:ss&amp;quot;.  If no date string is given, returns the current time (same as nowVal).&lt;br /&gt;
|-&lt;br /&gt;
| [[dateTime.year|year(date)]] || Get the year of the given date, as a number.&lt;br /&gt;
|-&lt;br /&gt;
| [[dateTime.month|month(date)]] || Get the month of the given date, as a number from 1 to 12.&lt;br /&gt;
|-&lt;br /&gt;
| [[dateTime.day|day(date)]] || Get the day of the given date, as a number from 1 to 31.&lt;br /&gt;
|-&lt;br /&gt;
| [[dateTime.hour|hour(date)]] || Get the hour of the given date/time, as a number from 0 to 23.&lt;br /&gt;
|-&lt;br /&gt;
| [[dateTime.minute|minute(date)]] || Get the minute of the given date/time, as a number from 0 to 59.&lt;br /&gt;
|-&lt;br /&gt;
| [[dateTime.second|second(date)]] || Get the second of the given date, as a number from 0 to 59.&lt;br /&gt;
|-&lt;br /&gt;
| [[dateTime.weekday|weekday(date)]] || Get the day of the week for the given date, from 0 (Sunday) to 6 (Saturday).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Properties ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| [[dateTime.weekdayNames | weekdayNames]] || Weekday name abbreviations, in the order returned by the weekday function.  DO NOT CHANGE THESE, or the weekday function will no longer work.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&amp;lt;ms&amp;gt;&lt;br /&gt;
	import &amp;quot;dateTime&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	print &amp;quot;It is now: &amp;quot; + dateTime.now&lt;br /&gt;
&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:Sys Modules]]&lt;/div&gt;</summary>
		<author><name>Redspark</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=DateTime&amp;diff=1380</id>
		<title>DateTime</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=DateTime&amp;diff=1380"/>
		<updated>2025-03-31T07:43:55Z</updated>

		<summary type="html">&lt;p&gt;Redspark: Added Parameters&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Mini Micro supports dates/times in two different formats: as a string (by default in SQL format), and as a number of seconds since a reference date (Jan 01, 2000).  The numeric format is useful for doing date/time calculations, like finding the amount of time between two dates, or adding some amount of time to a starting date/time.&lt;br /&gt;
&lt;br /&gt;
For details on the format specifiers: https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings .&lt;br /&gt;
&lt;br /&gt;
== Functions ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| [[dateTime.nowVal|nowVal]] || Get the current date/time, as a number.&lt;br /&gt;
|-&lt;br /&gt;
| [[dateTime.now|now(format)]] || Return the current date/time as a string. By default, format = &amp;quot;yyyy-MM-dd HH:mm:ss&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
| [[dateTime.str|strdate, format)]] || Convert a date (string or number) to a string with the given format. By default, format = &amp;quot;yyyy-MM-dd HH:mm:ss&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
| [[dateTime.val|val(dateStr)]] || Convert a date string to a number. By default, format = &amp;quot;yyyy-MM-dd HH:mm:ss&amp;quot;.  If no date string is given, returns the current time (same as nowVal).&lt;br /&gt;
|-&lt;br /&gt;
| [[dateTime.year|year(date)]] || Get the year of the given date, as a number.&lt;br /&gt;
|-&lt;br /&gt;
| [[dateTime.month|month(date)]] || Get the month of the given date, as a number from 1 to 12.&lt;br /&gt;
|-&lt;br /&gt;
| [[dateTime.day|day(date)]] || Get the day of the given date, as a number from 1 to 31.&lt;br /&gt;
|-&lt;br /&gt;
| [[dateTime.hour|hour(date)]] || Get the hour of the given date/time, as a number from 0 to 23.&lt;br /&gt;
|-&lt;br /&gt;
| [[dateTime.minute|minute(date)]] || Get the minute of the given date/time, as a number from 0 to 59.&lt;br /&gt;
|-&lt;br /&gt;
| [[dateTime.second|second(date)]] || Get the second of the given date, as a number from 0 to 59.&lt;br /&gt;
|-&lt;br /&gt;
| [[dateTime.weekday|weekday(date)]] || Get the day of the week for the given date, from 0 (Sunday) to 6 (Saturday).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Properties ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| [[dateTime.weekdayNames | weekdayNames]] || Weekday name abbreviations, in the order returned by the weekday function.  DO NOT CHANGE THESE, or the weekday function will no longer work.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&amp;lt;ms&amp;gt;&lt;br /&gt;
	import &amp;quot;dateTime&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	print &amp;quot;It is now: &amp;quot; + dateTime.now&lt;br /&gt;
&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:Sys Modules]]&lt;/div&gt;</summary>
		<author><name>Redspark</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=DateTime&amp;diff=1379</id>
		<title>DateTime</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=DateTime&amp;diff=1379"/>
		<updated>2025-03-31T07:42:07Z</updated>

		<summary type="html">&lt;p&gt;Redspark: Initial Page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Mini Micro supports dates/times in two different formats: as a string (by default in SQL format), and as a number of seconds since a reference date (Jan 01, 2000).  The numeric format is useful for doing date/time calculations, like finding the amount of time between two dates, or adding some amount of time to a starting date/time.&lt;br /&gt;
&lt;br /&gt;
For details on the format specifiers: https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings .&lt;br /&gt;
&lt;br /&gt;
== Functions ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| [[dateTime.nowVal|nowVal]] || Get the current date/time, as a number.&lt;br /&gt;
|-&lt;br /&gt;
| [[dateTime.now|now(format)]] || Return the current date/time as a string. By default, format = &amp;quot;yyyy-MM-dd HH:mm:ss&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
| [[dateTime.str|str]] || Convert a date (string or number) to a string with the given format. By default, format = &amp;quot;yyyy-MM-dd HH:mm:ss&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
| [[dateTime.val|val]] || Convert a date string to a number. By default, format = &amp;quot;yyyy-MM-dd HH:mm:ss&amp;quot;.  If no date string is given, returns the current time (same as nowVal).&lt;br /&gt;
|-&lt;br /&gt;
| [[dateTime.year|year]] || Get the year of the given date, as a number.&lt;br /&gt;
|-&lt;br /&gt;
| [[dateTime.month|month]] || Get the month of the given date, as a number from 1 to 12.&lt;br /&gt;
|-&lt;br /&gt;
| [[dateTime.day|day]] || Get the day of the given date, as a number from 1 to 31.&lt;br /&gt;
|-&lt;br /&gt;
| [[dateTime.hour|hour]] || Get the hour of the given date/time, as a number from 0 to 23.&lt;br /&gt;
|-&lt;br /&gt;
| [[dateTime.minute|minute]] || Get the minute of the given date/time, as a number from 0 to 59.&lt;br /&gt;
|-&lt;br /&gt;
| [[dateTime.second|second]] || Get the second of the given date, as a number from 0 to 59.&lt;br /&gt;
|-&lt;br /&gt;
| [[dateTime.weekday|weekday]] || Get the day of the week for the given date, from 0 (Sunday) to 6 (Saturday).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Properties ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| [[dateTime.weekdayNames | weekdayNames]] || Weekday name abbreviations, in the order returned by the weekday function.  DO NOT CHANGE THESE, or the weekday function will no longer work.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&amp;lt;ms&amp;gt;&lt;br /&gt;
	import &amp;quot;dateTime&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	print &amp;quot;It is now: &amp;quot; + dateTime.now&lt;br /&gt;
&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:Sys Modules]]&lt;/div&gt;</summary>
		<author><name>Redspark</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Events&amp;diff=1378</id>
		<title>Events</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Events&amp;diff=1378"/>
		<updated>2025-03-31T07:17:47Z</updated>

		<summary type="html">&lt;p&gt;Redspark: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This system module defines the EventSprite class which expands on the Sprite class to add definable event functions called handlers.  These handlers are triggered under certain conditions such as a mouse being clicked.  A special EventLoop is defined to act as a dedicated game loop that manages all of the event classes.  Since the EventLoop is continuous until terminated by an event, &lt;br /&gt;
&lt;br /&gt;
== Classes ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| [[events.EventHandler|EventHandler]] || Stores information about the action to take when responding to an Event.&lt;br /&gt;
|-&lt;br /&gt;
| [[events.KeyHandler|KeyHandler]] || Stores the current state of a particular Key including whether it is Up, Down or being Held down.&lt;br /&gt;
|-&lt;br /&gt;
| [[events.EventSprite|EventSprite]] || Builds on the Sprite class to add event handlers that respond to events such as:  onKey, onKeyDown, onKeyUp, onClick, etc.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Event Loop ===&lt;br /&gt;
Within the module, there is a special singleton class call eventLoop which is meant to only exist once.  It governs the game loop and manages the responses to the triggered events.  This is a dedicated game loop which will continue to execute until an event terminates the loop or program in some way.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&amp;lt;ms&amp;gt;&lt;br /&gt;
	import &amp;quot;events&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	clear&lt;br /&gt;
	display(4).mode = displayMode.sprite&lt;br /&gt;
	spr = new events.EventSprite&lt;br /&gt;
	spr.image = file.loadImage(&amp;quot;/sys/pics/Wumpus.png&amp;quot;)&lt;br /&gt;
	spr.onKey = new events.KeyHandler&lt;br /&gt;
	spr.onKey[&amp;quot;left&amp;quot;] = function&lt;br /&gt;
		self.x = self.x - 10&lt;br /&gt;
		if self.x &amp;lt; 50 then eventLoop.stop&lt;br /&gt;
	end function&lt;br /&gt;
	spr.onKey[&amp;quot;right&amp;quot;] = function&lt;br /&gt;
		self.x = self.x + 10&lt;br /&gt;
	end function&lt;br /&gt;
	events.eventLoop.onKey[&amp;quot;escape&amp;quot;] = function&lt;br /&gt;
		eventLoop.stop&lt;br /&gt;
	end function&lt;br /&gt;
	events.eventLoop.onKeyDown[&amp;quot;space&amp;quot;] = function; print &amp;quot;space down&amp;quot;; end function&lt;br /&gt;
	events.eventLoop.onKey[&amp;quot;space&amp;quot;] = function; print &amp;quot;space held&amp;quot;; end function&lt;br /&gt;
	events.eventLoop.onKeyUp[&amp;quot;space&amp;quot;] = function; print &amp;quot;space up&amp;quot;; end function&lt;br /&gt;
	&lt;br /&gt;
	spr.onClick = function&lt;br /&gt;
		self.scale = 1.5&lt;br /&gt;
	end function&lt;br /&gt;
	spr.onDrag = function&lt;br /&gt;
		self.x = mouse.x&lt;br /&gt;
		self.y = mouse.y&lt;br /&gt;
	end function&lt;br /&gt;
	spr.onDragEnd = function&lt;br /&gt;
		self.scale = 1&lt;br /&gt;
	end function&lt;br /&gt;
	&lt;br /&gt;
	spr.x = 480&lt;br /&gt;
	spr.y = 320&lt;br /&gt;
	spr.start&lt;br /&gt;
	&lt;br /&gt;
	print &amp;quot;Click and drag, or press left/right.&amp;quot;&lt;br /&gt;
	print &amp;quot;All event-driven.  (Esc to exit.)&amp;quot;&lt;br /&gt;
	&lt;br /&gt;
	events.eventLoop.run&lt;br /&gt;
&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:Sys Modules]]&lt;/div&gt;</summary>
		<author><name>Redspark</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Chars&amp;diff=1377</id>
		<title>Chars</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Chars&amp;diff=1377"/>
		<updated>2025-03-31T07:14:25Z</updated>

		<summary type="html">&lt;p&gt;Redspark: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This system module contains names for all the special characters supported by Mini Micro.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Character&lt;br /&gt;
|-&lt;br /&gt;
| left || ←&lt;br /&gt;
|-&lt;br /&gt;
| right || →&lt;br /&gt;
|-&lt;br /&gt;
| up || ↑&lt;br /&gt;
|-&lt;br /&gt;
| down || ↓&lt;br /&gt;
|-&lt;br /&gt;
| leftArrow || ←&lt;br /&gt;
|-&lt;br /&gt;
| rightArrow || →&lt;br /&gt;
|-&lt;br /&gt;
| upArrow || ↑&lt;br /&gt;
|-&lt;br /&gt;
| downArrow || ↓&lt;br /&gt;
|-&lt;br /&gt;
| unprintable || ¡&lt;br /&gt;
|-&lt;br /&gt;
| buttonCapLeft || [&lt;br /&gt;
|-&lt;br /&gt;
| buttonCapRight || ]&lt;br /&gt;
|-&lt;br /&gt;
| figureStanding || char(57872)&lt;br /&gt;
|-&lt;br /&gt;
| figureWaitingToeDown || char(57873)&lt;br /&gt;
|-&lt;br /&gt;
| figureWaitingToeUp || char(57874)&lt;br /&gt;
|-&lt;br /&gt;
| figureAkimbo || char(57875)&lt;br /&gt;
|-&lt;br /&gt;
| mu || &amp;amp;#181;&lt;br /&gt;
|-&lt;br /&gt;
| invertedBang || ¡&lt;br /&gt;
|-&lt;br /&gt;
| copyright || &amp;amp;copy;&lt;br /&gt;
|-&lt;br /&gt;
| lineEndSymbol || &amp;amp;#172;&lt;br /&gt;
|-&lt;br /&gt;
| registered || &amp;amp;#174;&lt;br /&gt;
|-&lt;br /&gt;
| degrees || &amp;amp;#176;&lt;br /&gt;
|-&lt;br /&gt;
| invertedQuestion || &amp;amp;#191;&lt;br /&gt;
|-&lt;br /&gt;
| multSign || &amp;amp;#215;&lt;br /&gt;
|-&lt;br /&gt;
| divSign || &amp;amp;#247;&lt;br /&gt;
|-&lt;br /&gt;
| pi || &amp;amp;#960;&lt;br /&gt;
|-&lt;br /&gt;
| tau || &amp;amp;#964;&lt;br /&gt;
|-&lt;br /&gt;
| bullet || &amp;amp;#8226;&lt;br /&gt;
|-&lt;br /&gt;
| tree || char(127794)&lt;br /&gt;
|-&lt;br /&gt;
| ellipsis || &amp;amp;#8230;&lt;br /&gt;
|-&lt;br /&gt;
| emptyBox || &amp;amp;#9744;&lt;br /&gt;
|-&lt;br /&gt;
| checkedBox || &amp;amp;#9745;&lt;br /&gt;
|-&lt;br /&gt;
| boxWithX || &amp;amp;#9746;&lt;br /&gt;
|-&lt;br /&gt;
| spade || &amp;amp;#9824;&lt;br /&gt;
|-&lt;br /&gt;
| club || &amp;amp;#9827;&lt;br /&gt;
|-&lt;br /&gt;
| heart || &amp;amp;#9829;&lt;br /&gt;
|-&lt;br /&gt;
| diamond || &amp;amp;#9830;&lt;br /&gt;
|-&lt;br /&gt;
| dieFace[1] || &amp;amp;#9856;&lt;br /&gt;
|-&lt;br /&gt;
| dieFace[2] || &amp;amp;#9857;&lt;br /&gt;
|-&lt;br /&gt;
| dieFace[3] || &amp;amp;#9858;&lt;br /&gt;
|-&lt;br /&gt;
| dieFace[4] || &amp;amp;#9859;&lt;br /&gt;
|-&lt;br /&gt;
| dieFace[5] || &amp;amp;#9860;&lt;br /&gt;
|-&lt;br /&gt;
| dieFace[6] || &amp;amp;#9861;&lt;br /&gt;
|-&lt;br /&gt;
| inverseOn || Inverts all future printed characters&lt;br /&gt;
|-&lt;br /&gt;
| inverseOff || Removes Inverted printing&lt;br /&gt;
|-&lt;br /&gt;
| bell || Plays a tone&lt;br /&gt;
|-&lt;br /&gt;
| backup || char(8)&lt;br /&gt;
|-&lt;br /&gt;
| tab || char(9)&lt;br /&gt;
|-&lt;br /&gt;
| esc || char(27)&lt;br /&gt;
|-&lt;br /&gt;
| returnKey || char(10)&lt;br /&gt;
|-&lt;br /&gt;
| enterKey || char(3)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&amp;lt;ms&amp;gt;&lt;br /&gt;
	import &amp;quot;chars&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	text.clear&lt;br /&gt;
	text.row = 25&lt;br /&gt;
	print &amp;quot;Special characters:&amp;quot;&lt;br /&gt;
	print&lt;br /&gt;
	printAlign = function(label, text)&lt;br /&gt;
		print &amp;quot; &amp;quot; * (30 - label.len) + label + &amp;quot;: &amp;quot; + text&lt;br /&gt;
	end function&lt;br /&gt;
	printAlign &amp;quot;left or leftArrow&amp;quot;, chars.leftArrow&lt;br /&gt;
	printAlign &amp;quot;up or upArrow&amp;quot;, chars.upArrow&lt;br /&gt;
	printAlign &amp;quot;right or rightArrow&amp;quot;, chars.rightArrow&lt;br /&gt;
	printAlign &amp;quot;down or rightArrow&amp;quot;, chars.downArrow&lt;br /&gt;
	printAlign &amp;quot;unprintable&amp;quot;, chars.unprintable&lt;br /&gt;
	printAlign &amp;quot;buttonCapLeft&amp;quot;, chars.buttonCapLeft&lt;br /&gt;
	printAlign &amp;quot;buttonCapRight&amp;quot;, chars.buttonCapRight&lt;br /&gt;
	printAlign &amp;quot;figureStanding&amp;quot;, chars.figureStanding&lt;br /&gt;
	printAlign &amp;quot;figureWaitingToeDown&amp;quot;, chars.figureWaitingToeDown&lt;br /&gt;
	printAlign &amp;quot;figureWaitingToeUp&amp;quot;, chars.figureWaitingToeUp&lt;br /&gt;
	printAlign &amp;quot;figureAkimbo&amp;quot;, chars.figureAkimbo&lt;br /&gt;
	printAlign &amp;quot;mu, pi, tau&amp;quot;, chars.mu + &amp;quot; &amp;quot; + chars.pi + &amp;quot; &amp;quot; + chars.tau&lt;br /&gt;
	printAlign &amp;quot;bullet, ellipsis, degrees&amp;quot;, [chars.bullet, chars.ellipsis, chars.degrees].join&lt;br /&gt;
	printAlign &amp;quot;copyright, registered&amp;quot;, [chars.copyright, chars.registered].join&lt;br /&gt;
	printAlign &amp;quot;tree&amp;quot;, chars.tree&lt;br /&gt;
	printAlign &amp;quot;emptyBox&amp;quot;, chars.emptyBox&lt;br /&gt;
	printAlign &amp;quot;checkedBox&amp;quot;, chars.checkedBox&lt;br /&gt;
	printAlign &amp;quot;boxWithX&amp;quot;, chars.boxWithX&lt;br /&gt;
	printAlign &amp;quot;spade, club, heart, diamond&amp;quot;, [chars.spade, chars.club, chars.heart, chars.diamond].join&lt;br /&gt;
	printAlign &amp;quot;dieFace[1] - dieFace[6]&amp;quot;, [chars.dieFace[1], chars.dieFace[2], chars.dieFace[3],&lt;br /&gt;
			 chars.dieFace[4], chars.dieFace[5], chars.dieFace[6]].join&lt;br /&gt;
	print&lt;br /&gt;
&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:Sys Modules]]&lt;/div&gt;</summary>
		<author><name>Redspark</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Chars&amp;diff=1376</id>
		<title>Chars</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Chars&amp;diff=1376"/>
		<updated>2025-03-31T07:12:37Z</updated>

		<summary type="html">&lt;p&gt;Redspark: Initial page.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This module contains names for all the special characters supported by Mini Micro.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Character&lt;br /&gt;
|-&lt;br /&gt;
| left || ←&lt;br /&gt;
|-&lt;br /&gt;
| right || →&lt;br /&gt;
|-&lt;br /&gt;
| up || ↑&lt;br /&gt;
|-&lt;br /&gt;
| down || ↓&lt;br /&gt;
|-&lt;br /&gt;
| leftArrow || ←&lt;br /&gt;
|-&lt;br /&gt;
| rightArrow || →&lt;br /&gt;
|-&lt;br /&gt;
| upArrow || ↑&lt;br /&gt;
|-&lt;br /&gt;
| downArrow || ↓&lt;br /&gt;
|-&lt;br /&gt;
| unprintable || ¡&lt;br /&gt;
|-&lt;br /&gt;
| buttonCapLeft || [&lt;br /&gt;
|-&lt;br /&gt;
| buttonCapRight || ]&lt;br /&gt;
|-&lt;br /&gt;
| figureStanding || char(57872)&lt;br /&gt;
|-&lt;br /&gt;
| figureWaitingToeDown || char(57873)&lt;br /&gt;
|-&lt;br /&gt;
| figureWaitingToeUp || char(57874)&lt;br /&gt;
|-&lt;br /&gt;
| figureAkimbo || char(57875)&lt;br /&gt;
|-&lt;br /&gt;
| mu || &amp;amp;#181;&lt;br /&gt;
|-&lt;br /&gt;
| invertedBang || ¡&lt;br /&gt;
|-&lt;br /&gt;
| copyright || &amp;amp;copy;&lt;br /&gt;
|-&lt;br /&gt;
| lineEndSymbol || &amp;amp;#172;&lt;br /&gt;
|-&lt;br /&gt;
| registered || &amp;amp;#174;&lt;br /&gt;
|-&lt;br /&gt;
| degrees || &amp;amp;#176;&lt;br /&gt;
|-&lt;br /&gt;
| invertedQuestion || &amp;amp;#191;&lt;br /&gt;
|-&lt;br /&gt;
| multSign || &amp;amp;#215;&lt;br /&gt;
|-&lt;br /&gt;
| divSign || &amp;amp;#247;&lt;br /&gt;
|-&lt;br /&gt;
| pi || &amp;amp;#960;&lt;br /&gt;
|-&lt;br /&gt;
| tau || &amp;amp;#964;&lt;br /&gt;
|-&lt;br /&gt;
| bullet || &amp;amp;#8226;&lt;br /&gt;
|-&lt;br /&gt;
| tree || char(127794)&lt;br /&gt;
|-&lt;br /&gt;
| ellipsis || &amp;amp;#8230;&lt;br /&gt;
|-&lt;br /&gt;
| emptyBox || &amp;amp;#9744;&lt;br /&gt;
|-&lt;br /&gt;
| checkedBox || &amp;amp;#9745;&lt;br /&gt;
|-&lt;br /&gt;
| boxWithX || &amp;amp;#9746;&lt;br /&gt;
|-&lt;br /&gt;
| spade || &amp;amp;#9824;&lt;br /&gt;
|-&lt;br /&gt;
| club || &amp;amp;#9827;&lt;br /&gt;
|-&lt;br /&gt;
| heart || &amp;amp;#9829;&lt;br /&gt;
|-&lt;br /&gt;
| diamond || &amp;amp;#9830;&lt;br /&gt;
|-&lt;br /&gt;
| dieFace[1] || &amp;amp;#9856;&lt;br /&gt;
|-&lt;br /&gt;
| dieFace[2] || &amp;amp;#9857;&lt;br /&gt;
|-&lt;br /&gt;
| dieFace[3] || &amp;amp;#9858;&lt;br /&gt;
|-&lt;br /&gt;
| dieFace[4] || &amp;amp;#9859;&lt;br /&gt;
|-&lt;br /&gt;
| dieFace[5] || &amp;amp;#9860;&lt;br /&gt;
|-&lt;br /&gt;
| dieFace[6] || &amp;amp;#9861;&lt;br /&gt;
|-&lt;br /&gt;
| inverseOn || Inverts all future printed characters&lt;br /&gt;
|-&lt;br /&gt;
| inverseOff || Removes Inverted printing&lt;br /&gt;
|-&lt;br /&gt;
| bell || Plays a tone&lt;br /&gt;
|-&lt;br /&gt;
| backup || char(8)&lt;br /&gt;
|-&lt;br /&gt;
| tab || char(9)&lt;br /&gt;
|-&lt;br /&gt;
| esc || char(27)&lt;br /&gt;
|-&lt;br /&gt;
| returnKey || char(10)&lt;br /&gt;
|-&lt;br /&gt;
| enterKey || char(3)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&amp;lt;ms&amp;gt;&lt;br /&gt;
	import &amp;quot;chars&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	text.clear&lt;br /&gt;
	text.row = 25&lt;br /&gt;
	print &amp;quot;Special characters:&amp;quot;&lt;br /&gt;
	print&lt;br /&gt;
	printAlign = function(label, text)&lt;br /&gt;
		print &amp;quot; &amp;quot; * (30 - label.len) + label + &amp;quot;: &amp;quot; + text&lt;br /&gt;
	end function&lt;br /&gt;
	printAlign &amp;quot;left or leftArrow&amp;quot;, chars.leftArrow&lt;br /&gt;
	printAlign &amp;quot;up or upArrow&amp;quot;, chars.upArrow&lt;br /&gt;
	printAlign &amp;quot;right or rightArrow&amp;quot;, chars.rightArrow&lt;br /&gt;
	printAlign &amp;quot;down or rightArrow&amp;quot;, chars.downArrow&lt;br /&gt;
	printAlign &amp;quot;unprintable&amp;quot;, chars.unprintable&lt;br /&gt;
	printAlign &amp;quot;buttonCapLeft&amp;quot;, chars.buttonCapLeft&lt;br /&gt;
	printAlign &amp;quot;buttonCapRight&amp;quot;, chars.buttonCapRight&lt;br /&gt;
	printAlign &amp;quot;figureStanding&amp;quot;, chars.figureStanding&lt;br /&gt;
	printAlign &amp;quot;figureWaitingToeDown&amp;quot;, chars.figureWaitingToeDown&lt;br /&gt;
	printAlign &amp;quot;figureWaitingToeUp&amp;quot;, chars.figureWaitingToeUp&lt;br /&gt;
	printAlign &amp;quot;figureAkimbo&amp;quot;, chars.figureAkimbo&lt;br /&gt;
	printAlign &amp;quot;mu, pi, tau&amp;quot;, chars.mu + &amp;quot; &amp;quot; + chars.pi + &amp;quot; &amp;quot; + chars.tau&lt;br /&gt;
	printAlign &amp;quot;bullet, ellipsis, degrees&amp;quot;, [chars.bullet, chars.ellipsis, chars.degrees].join&lt;br /&gt;
	printAlign &amp;quot;copyright, registered&amp;quot;, [chars.copyright, chars.registered].join&lt;br /&gt;
	printAlign &amp;quot;tree&amp;quot;, chars.tree&lt;br /&gt;
	printAlign &amp;quot;emptyBox&amp;quot;, chars.emptyBox&lt;br /&gt;
	printAlign &amp;quot;checkedBox&amp;quot;, chars.checkedBox&lt;br /&gt;
	printAlign &amp;quot;boxWithX&amp;quot;, chars.boxWithX&lt;br /&gt;
	printAlign &amp;quot;spade, club, heart, diamond&amp;quot;, [chars.spade, chars.club, chars.heart, chars.diamond].join&lt;br /&gt;
	printAlign &amp;quot;dieFace[1] - dieFace[6]&amp;quot;, [chars.dieFace[1], chars.dieFace[2], chars.dieFace[3],&lt;br /&gt;
			 chars.dieFace[4], chars.dieFace[5], chars.dieFace[6]].join&lt;br /&gt;
	print&lt;br /&gt;
&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:Sys Modules]]&lt;/div&gt;</summary>
		<author><name>Redspark</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Events&amp;diff=1375</id>
		<title>Events</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Events&amp;diff=1375"/>
		<updated>2025-03-30T20:35:39Z</updated>

		<summary type="html">&lt;p&gt;Redspark: Initial page.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This system module defines the EventSprite class which expands on the Sprite class to add definable event functions called handlers.  These handlers are triggered under certain conditions such as a mouse being clicked.  A special EventLoop is defined to act as a dedicated game loop that manages all of the event classes.  Since the EventLoop is continuous until terminated by an event, &lt;br /&gt;
&lt;br /&gt;
== Classes ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| [[events.EventHandler|EventHandler]] || Stores information about the action to take when responding to an Event.&lt;br /&gt;
|-&lt;br /&gt;
| [[events.KeyHandler|KeyHandler]] || Stores the current state of a particular Key including whether it is Up, Down or being Held down.&lt;br /&gt;
|-&lt;br /&gt;
| [[events.EventSprite|EventSprite]] || Builds on the Sprite class to add event handlers that respond to events such as:  onKey, onKeyDown, onKeyUp, onClick, etc.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Event Loop ===&lt;br /&gt;
Within the module, there is a special singleton class call eventLoop which is meant to only exist once.  It governs the game loop and manages the responses to the triggered events.  This is a dedicated game loop which will continue to execute until an event terminates the loop or program in some way.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&amp;lt;ms&amp;gt;&lt;br /&gt;
	clear&lt;br /&gt;
	display(4).mode = displayMode.sprite&lt;br /&gt;
	spr = new EventSprite&lt;br /&gt;
	spr.image = file.loadImage(&amp;quot;/sys/pics/Wumpus.png&amp;quot;)&lt;br /&gt;
	spr.onKey = new KeyHandler&lt;br /&gt;
	spr.onKey[&amp;quot;left&amp;quot;] = function&lt;br /&gt;
		self.x = self.x - 10&lt;br /&gt;
		if self.x &amp;lt; 50 then eventLoop.stop&lt;br /&gt;
	end function&lt;br /&gt;
	spr.onKey[&amp;quot;right&amp;quot;] = function&lt;br /&gt;
		self.x = self.x + 10&lt;br /&gt;
	end function&lt;br /&gt;
	eventLoop.onKey[&amp;quot;escape&amp;quot;] = function&lt;br /&gt;
		eventLoop.stop&lt;br /&gt;
	end function&lt;br /&gt;
	eventLoop.onKeyDown[&amp;quot;space&amp;quot;] = function; print &amp;quot;space down&amp;quot;; end function&lt;br /&gt;
	eventLoop.onKey[&amp;quot;space&amp;quot;] = function; print &amp;quot;space held&amp;quot;; end function&lt;br /&gt;
	eventLoop.onKeyUp[&amp;quot;space&amp;quot;] = function; print &amp;quot;space up&amp;quot;; end function&lt;br /&gt;
	&lt;br /&gt;
	spr.onClick = function&lt;br /&gt;
		self.scale = 1.5&lt;br /&gt;
	end function&lt;br /&gt;
	spr.onDrag = function&lt;br /&gt;
		self.x = mouse.x&lt;br /&gt;
		self.y = mouse.y&lt;br /&gt;
	end function&lt;br /&gt;
	spr.onDragEnd = function&lt;br /&gt;
		self.scale = 1&lt;br /&gt;
	end function&lt;br /&gt;
	&lt;br /&gt;
	spr.x = 480&lt;br /&gt;
	spr.y = 320&lt;br /&gt;
	spr.start&lt;br /&gt;
	&lt;br /&gt;
	print &amp;quot;Click and drag, or press left/right.&amp;quot;&lt;br /&gt;
	print &amp;quot;All event-driven.  (Esc to exit.)&amp;quot;&lt;br /&gt;
	&lt;br /&gt;
	eventLoop.run&lt;br /&gt;
&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;br /&gt;
[[Category:Sys Modules]]&lt;/div&gt;</summary>
		<author><name>Redspark</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Color.fromListHSV&amp;diff=1374</id>
		<title>Color.fromListHSV</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Color.fromListHSV&amp;diff=1374"/>
		<updated>2025-03-29T14:48:25Z</updated>

		<summary type="html">&lt;p&gt;Redspark: Initial.  Duplicated from color.fromList&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;c&amp;gt;[[color]].fromListHSV&amp;lt;/c&amp;gt; converts a color in RGB list form — hue, saturation, value, and optional alpha, all in the range 0-255 — to a string in standard HSV color form.&lt;br /&gt;
&lt;br /&gt;
See also: [[color.toListHSV]]&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 !! Type !! Default Value !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| ''hsvaList'' || list || null || list of the form &amp;lt;c&amp;gt;[hue, saturation, value]&amp;lt;/c&amp;gt; or &amp;lt;c&amp;gt;[hue, saturation, value, alpha]&amp;lt;/c&amp;gt;&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
=== Usage Notes ===&lt;br /&gt;
All methods and colors in the Mini Micro API, except this one, represent colors as hexadecimal strings, e.g. &amp;lt;c&amp;gt;&amp;quot;#FF8080C8&amp;quot;&amp;lt;/c&amp;gt;.  However, sometimes it is convenient to represent a color as a list of numbers, so for example you can do math with them.  Then, use &amp;lt;c&amp;gt;color.fromListHSV&amp;lt;/c&amp;gt; to convert this list back into standard HSV color form.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;print color.fromListHSV([255, 128, 20, 200])&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above prints &amp;lt;c&amp;gt;#140A0AC8&amp;lt;/c&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;/div&gt;</summary>
		<author><name>Redspark</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Color.toListHSV&amp;diff=1373</id>
		<title>Color.toListHSV</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Color.toListHSV&amp;diff=1373"/>
		<updated>2025-03-29T14:43:48Z</updated>

		<summary type="html">&lt;p&gt;Redspark: Initial.  Duplicated from color.toList&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;c&amp;gt;[[color]].toListHSV&amp;lt;/c&amp;gt; converts a color in standard string form to a list of four numbers: hue, saturation, value, and alpha, all in the range 0-255.&lt;br /&gt;
&lt;br /&gt;
See also: [[color.toListHSV]]&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 !! Type !! Default Value !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| ''colorString'' || string || null || string in standard HSV color form&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
=== Usage Notes ===&lt;br /&gt;
All methods and colors in the Mini Micro API, except this one, represent colors as hexadecimal strings, e.g. &amp;lt;c&amp;gt;&amp;quot;#FF8080C8&amp;quot;&amp;lt;/c&amp;gt;.  However, sometimes it is convenient to represent a color as a list of numbers, so for example you can do math with them.  In such cases, you can use &amp;lt;c&amp;gt;color.toList&amp;lt;/c&amp;gt; to convert to list form, then later use &amp;lt;c&amp;gt;[[color.fromListHSV]]&amp;lt;/c&amp;gt; to convert back into standard HSV color form.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;print color.toListHSV(color.brown)&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above prints &amp;lt;c&amp;gt;[21, 170, 153, 255]&amp;lt;/c&amp;gt;, representing the color brown.  The hue value is 21, saturation is 170, value is 153, and the alpha value is 255 (fully opaque).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;/div&gt;</summary>
		<author><name>Redspark</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Color.hsv&amp;diff=1372</id>
		<title>Color.hsv</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Color.hsv&amp;diff=1372"/>
		<updated>2025-03-29T14:32:07Z</updated>

		<summary type="html">&lt;p&gt;Redspark: Initial.  Duplicated from color.rgb&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In [[Mini Micro]], the &amp;lt;c&amp;gt;[[color]].hsv&amp;lt;/c&amp;gt; method returns a [[color]] string from Hue, Saturation, and Value values in the range 0-255.&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;
| h || red component (0-255)&lt;br /&gt;
|-&lt;br /&gt;
| s || green component (0-255)&lt;br /&gt;
|-&lt;br /&gt;
| v || blue component (0-255)&lt;br /&gt;
|-&lt;br /&gt;
| a || alpha component (0-255).  Defaults to 255.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
First three parameters are required.  The result is a 9-character color string with an alpha.&lt;br /&gt;
&lt;br /&gt;
See also: [[color.rgba]]&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;print color.hsv(50,100,200)&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
  #BAC87AFF&lt;br /&gt;
&lt;br /&gt;
[[Category:Mini Micro]]&lt;/div&gt;</summary>
		<author><name>Redspark</name></author>
		
	</entry>
</feed>