> ashref file
boolean file_to_map( string, aggregate )
boolean file_to_map( string, aggregate, boolean )
boolean map_to_file( aggregate, string )
boolean map_to_file( aggregate, string, boolean )
> ashref log
void logprint( string )
int [int] reverse_numberology( )
int [int] reverse_numberology( int, int )
string [int] session_logs( int )
string [int] session_logs( string, int )
Hehe, those two ashrefs were the first thing I triedI was vaguely aware of map_to_file back when I actually knew what I was doing with ASH, but I don't remember the first thing about it - and it didn't occur to me for this task. I remember Veracity wrote a tutorial on maps somewhere in the official documentation, guess that's the first thing I should read up
Thanks for the pointers!
Yes, I invented ASH maps (and records and arrays). Glad you like them!
Is there a comment character that file_to_map respects?
Correct. Mafia ignores the octothorp commented line.
map_to_file() always overwrites all data currently existing in a file. Anything else would be bad. There is no command to merge new data into an existing file.
Fair enough, meaning there is no way to write a header, other than forcing all variables to string and using a dummy key for the header?
ash string[int] thing; thing[-1]="header"; thing[0]="item 1"; thing[1]="item 2"; map_to_file(thing,"thingtest.txt");
record sometype { int id; string desc; int value; };
sometype [int] map;
...
map_to_file(map,"filename");
// file will look something like this - column names derived from record attributes' names
# id desc value
1 1 text1 1
...
{
boolean [string] clannies = who_clan();
foreach clannie in clannies {
map_to_file( clannies , "whosinclan.txt" );
}
But when the info is returned to mafia, it looks like this:
PazSox, Easyfax, This member, That member