Map Loader

This loader is slightly different from all the rest, as the item in the inventory with the ".map" suffix must be a directory. Each item in the directory is autoloaded and entered into the map.

File Format

Technically this doesn't load a file, it loads a directory and it's contents.

The most simple example is to create an empty directory in the inventory, e.g. simple.map. This would create a new map, with no entries and assign it to a variable called simple. This would be identical to the following:

var simple = newTreeMap();
        

This loader becomes really useful when you need a map of strings to different MillScript types, e.g. functions, XML, etc. You could write a large piece of MillScript to achieve the same effect, but the various loaders exist to save that.

A more complex example might have a directory in the inventory called harder.map. In that directory you might create a text file text.txt, a lines file somelines.lines, a template template.tp and a millscript file processtext.ms. Then when using the autoloaded map you would see the following:

MillScript code Resulting datatype
harder["text"] string
harder["somelines"] list
harder["template"] template function
harder["processtext"] function

Use

  1. Create a directory in your inventory with a suffix of map, containing all the required entries, as detailed in the file format. e.g Lets assume you create a file called test.map.
  2. To use the connection within a script, we just have to refer to the name of the map folder, e.g.
    test
                
    and this will load the map for us.

Notes