From WikiChip
Editing mirc/commands/hload

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

This page supports semantic in-text annotations (e.g. "[[Is specified as::World Heritage Site]]") to build structured and queryable content provided by Semantic MediaWiki. For a comprehensive description on how to use annotations or the #ask parser function, please have a look at the getting started, in-text annotation, or inline queries help pages.

Latest revision Your text
Line 1: Line 1:
{{mirc title|/hload Command}}
+
The '''/load command''' loads a text file to an hash table. /hload does not create the table, it must already have been created by {{mIRC|/hmake}}.
The '''/hload''' command loads a text file to an hash table. /hload does not create the table, it must already have been created by {{mIRC|/hmake}} then saved to disk using {{mIRC|/hsave}}.
+
 
 
== Synopsis ==
 
== Synopsis ==
  /hload -sBbnmN <name> <filename>
+
  /hload -sbni <name> <filename> [section]
/hload -sinmN <name> <filename> [section]
 
  
 
== Switches ==
 
== Switches ==
 +
* '''-b''' - loads binary files, [[$cr identifier - mIRC|$cr]] and [[$lf identifier - mIRC|$lf]] are preserved when saving as binary files
 +
* '''-n''' - loads files as data only, each item is a number, starting at N = 1
 +
* '''-i''' - treats the file as an ini file
 
* '''-s''' - display a message if successful: "* Loaded hash table '<name>' from '<filename>'
 
* '''-s''' - display a message if successful: "* Loaded hash table '<name>' from '<filename>'
* '''-b''' - loads binary files, {{mIRC|$cr}} and {{mIRC|$lf}} and 0x00's etc are preserved when saving as binary files
 
* '''-B''' - uses a larger index than -b to allow longer binary data to be saved. This is not compatible with files created by the -b switch.
 
* '''-n''' - loads files as data only, each item is a sequential integer, starting at N = 1
 
* '''-i''' - treats the file as an ini file format
 
* '''-mN''' - create the hash table if it does not exist, you can optionally specify N for the number of buckets in the range 1-10000, default 100 if N not used.
 
  
 
== Parameters ==
 
== Parameters ==
 
* '''<name>''' - the name of the hash table
 
* '''<name>''' - the name of the hash table
* '''<filename>''' - the file from which you want to load. Filename containing space much be enclosed in doublequotes.
+
* '''<filename>''' - the file you want to load from
* '''[section]''' - if -i is used, you can specify a section to be loaded. Default section name when parameter not used: hashtable (Should not use the square braces around the Section name.)
+
* '''[section]''' - if -i is used, you can specify a section to be loaded
== Notes ==
+
 
* Note: /hload uses the same syntax as /hsave except /hload has the -mN switch but does not have /hsave's -u switch.
 
* Note: If using /hload -i or -b or -n switches, it assumes the data was /hsave'ed to disk using those same switches.
 
* Note: If /hload into a table containing existing items, any match between existing item name and the items loaded from disk replaces the existing item's value with the value from disk, but any other existing items in the table are not affected by an /hload command.
 
 
== Example ==
 
== Example ==
<source lang="mIRC">
+
None
//hfree -w test | hload -im1n test $nopath($mircini) colors | var %tot $hget(test,0).item , %i 1 | while (%i <= %tot) { echo -a $ord(%i) item is $hget(test,%i).item containing $hget(test,$hget(test,%i).item) | inc %i }
 
* Loads color scheme names and event colors into items named after the integers 1 and greater. These are contained in the colors section of mirc.ini. If the 'n' switch were not used, the item names would instead be named the same as the items in mirc.ini; n0 n1 etc.
 
* If using the -n switch, do not expect the same values to be loaded into the same integer item names from which they were /hsave'ed to disk, even if using 1 bucket.
 
 
 
//hload -m test no_such_file | echo -a does not display
 
* Attempting to load a non-existent filename is an error which halts execution of the script.
 
  
//bset &var 1 $regsubex($str(x,256),/x/gi,$calc(\n -1) $chr(32)) | hfree -w test | hadd -mb test ascii &var | hsave -b test test.dat | hload -mb test2 test.dat | noop $hget(test,ascii,&copy) | echo 4 -a $bvar(&copy,1-)
 
* Binary variable can be accurately saved to a hashtable item, then /hsave'ed to disk with the -b switch, then /hload'ed from disk with the -b switch. The display shows &copy containing an un-altered copy of the original binary variable.
 
</source>
 
 
== Compatibility ==
 
== Compatibility ==
 
Added: 5.8
 
Added: 5.8
 +
 +
Added On: 05/09/2000
 +
 +
<small>Note: Individual switches were not taken into consideration.</small>
 +
 
== See also ==
 
== See also ==
 +
* [[List of commands - mIRC|List of commands]]
 +
* [[List of identifiers - mIRC|List of identifiers]]
 +
* [[$hget identifier - mIRC|$hget]]
 +
* [[$hfind identifier - mIRC|$hfind]]
 +
* {{mIRC|/hadd}}
 +
* {{mIRC|/hdec}}
 +
* {{mIRC|/hinc}}
 
* {{mIRC|/hmake}}
 
* {{mIRC|/hmake}}
* {{mIRC|/hfree}}
 
 
* {{mIRC|/hsave}}
 
* {{mIRC|/hsave}}
* {{mIRC|Hash Tables}}
+
{{mIRC command list}}
* {{mIRC|/hadd}}
+
 
* {{mIRC|/hdel}}
+
[[Category:MIRC commands]]
* {{mIRC|/hinc}}
 
* {{mIRC|/hdec}}
 
* {{mIRC|$hget}}
 
* {{mIRC|$hfind}}
 

Please note that all contributions to WikiChip may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see WikiChip:Copyrights for details). Do not submit copyrighted work without permission!

Cancel | Editing help (opens in new window)