Difference between revisions of "Hload"

From Scriptwiki
Jump to: navigation, search
 
m (clarified a lil)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
Loads a table from a file.
+
Loads a hash table from a file.
 
  /hload -sbni <name> <filename> [section]
 
  /hload -sbni <name> <filename> [section]
  
These loads plain text from a text file, with item and data on separate lines.
+
This command fills a hash table with the contents of a text file. The first line of the file is treated as the first item, and its data is supposed to be the second line. Third line is the second item and its data is the fourth line etc.
  
 
Using the -s switch makes the command display the result (e.g. ''* Loaded hash table 'users' from 'users.dat''')
 
Using the -s switch makes the command display the result (e.g. ''* Loaded hash table 'users' from 'users.dat''')
Line 20: Line 20:
 
That one loads the section ''myusers'' of the ini called ''users.ini'' to hashtable users and displays the result.
 
That one loads the section ''myusers'' of the ini called ''users.ini'' to hashtable users and displays the result.
  
[[Category:Hash Table]]
+
[[Category:Hash Table]][[Category:Commands]]

Latest revision as of 03:13, 18 February 2006

Loads a hash table from a file.

/hload -sbni <name> <filename> [section]

This command fills a hash table with the contents of a text file. The first line of the file is treated as the first item, and its data is supposed to be the second line. Third line is the second item and its data is the fourth line etc.

Using the -s switch makes the command display the result (e.g. * Loaded hash table 'users' from 'users.dat')

The -b switch loads binary files.

You can use -n to load files as data only, with no items. When loading with -n each line of data is assigned an N item value, starting at N = 1.

The -i switch treats the file as an ini file. You can specify an optional section name after the filename.

Note that /hload does not create the table, it must already have been created by /hmake.

Example

hload users users.dat

This simple example just loads users.dat into a hashtable called users.

hload -si users users.ini myusers

That one loads the section myusers of the ini called users.ini to hashtable users and displays the result.