Difference between revisions of "Load"

From MiniScript Wiki
Jump to navigation Jump to search
(Created page with "In Mini Micro, the <c>load</c> command loads a program into memory from disk. Syntax: load ''path'' This replaces the current program in memory with the MiniScript fi...")
 
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
In [[Mini Micro]], the <c>load</c> command loads a program into memory from disk.  Syntax:
+
In [[Mini Micro]] and [[Farmtronics]], the <c>load</c> command loads a program into memory from disk.  Syntax:
  
 
   load ''path''
 
   load ''path''
Line 7: Line 7:
 
  The path may be a full (absolute) path, or a partial path relative to the current working directory.  Note that the file extension (<c>.ms</c>) is optional in both <c>[[save]]</c> and <c>load</c>.
 
  The path may be a full (absolute) path, or a partial path relative to the current working directory.  Note that the file extension (<c>.ms</c>) is optional in both <c>[[save]]</c> and <c>load</c>.
  
== Example ==
+
== Examples ==
  
 
The following loads <c>theMatrix.ms</c> located in the <c>/sys/demo</c> directory on the system disk, and then runs it.
 
The following loads <c>theMatrix.ms</c> located in the <c>/sys/demo</c> directory on the system disk, and then runs it.
Line 13: Line 13:
 
<ms>load "/sys/demo/theMatrix"
 
<ms>load "/sys/demo/theMatrix"
 
run</ms>
 
run</ms>
 +
 +
The next example shows a useful pattern when using an external editor to work on a program.  After each edit (outside of Mini Micro), clear the environment, reload, and run the program with a compound command like this:
 +
 +
<ms>reset; load "myProgram"; run</ms>
  
 
[[Category:Mini Micro]]
 
[[Category:Mini Micro]]
 +
[[Category:Farmtronics]]

Latest revision as of 03:26, 7 May 2022

In Mini Micro and Farmtronics, the load command loads a program into memory from disk. Syntax:

 load path

This replaces the current program in memory with the MiniScript file at path. Caution: any unsaved changes in your previous program are lost without warning.

The path may be a full (absolute) path, or a partial path relative to the current working directory.  Note that the file extension (.ms) is optional in both save and load.

Examples

The following loads theMatrix.ms located in the /sys/demo directory on the system disk, and then runs it.

load "/sys/demo/theMatrix"
run

The next example shows a useful pattern when using an external editor to work on a program. After each edit (outside of Mini Micro), clear the environment, reload, and run the program with a compound command like this:

reset; load "myProgram"; run