I'm trying to create a script that will track the incoming and outgoing house members based on house logs in Achaea. Similar to how city Ambassadors do it, but I'm wanting to automate the tracking a bit, and maintain a database with it.
I'm wanting to load a table of the current year's house membership, and quits/suicides, but I'm not quite sure how to save or load tables, nor how they handle nested tables.
I'd like to be able to call a table say from y598 and compare it to the table from y599. handling the table itself won't be too difficult, but I'm wanting to maintain the data between sessions and I only know that table.save and table.load are the means to that, but everything I've read has been little help for me. Any help with this would be greatly appreciated.
Table loading and saving
Re: Table loading and saving
This will save the TABLE 'targetTable' to the FILE 'sometable.lua' in the mudlet home directory of your current profile.
This will load the TABLE 'targetTable' from the file 'sometable.lua' in the mudlet home directory.
All 'getMudletHomeDir()' does is return the file path for the mudlet home directory on your computer. So if you prefer to save your tables elsewhere, just change the file path to the appropriate location. This can be used in a type of application. IE. 'Triggers, Aliases, and Functions'. Just pick the method you are most comfortable with and test it out with a few a tables.
Re: Table loading and saving
Is there some way to force a user confirmation for the save? For what I'm doing, I don't want to accidentally overwrite a table
Re: Table loading and saving
you could write in a script for it I suppose. Make an alias that displays the table to save and where it is to be saved, then ask yourself for a confirmation. If yes, run this function, if no return.
Re: Table loading and saving
i'm just trying to figure out how to do that though. I know Rakon's GMCP inventory has something like that, bit i can't figure it out.
Re: Table loading and saving
Please show your latests tests and explain which problems you faced there exactly.Manni wrote:i'm just trying to figure out how to do that though.
Re: Table loading and saving
oh, no. the script in general works fine now, and I have an idea for the confirmation, but I just wondering if there was some sort of function in Mudlet or Lua that would be more efficient than activating and disabling an alias to check for the confirmation.