Page 2 of 2
Re: Persistent Variables?
Posted: Sat Jan 02, 2010 8:45 pm
by JerleMinara
Remember takes a string, not a variable reference.
Code: Select all
a = "somevalue"
echo (a .. "\n")
remember("a")
saveVars()
a = "deleted value"
echo(a .. "\n")
loadVars()
echo(a .. "\n")
Re: Persistent Variables?
Posted: Sat Jan 02, 2010 10:26 pm
by Alexander Divine
Ha ha, that totally worked. Awesome!
Thank ya much.
And actually, now that I can use it, I don't really need to save a whole lot (just my target, whether or not I had auto-bashing active, etc...) but would it be terribly straining on the system or bad practice if every time I changed a variable that I wanted saved I did the remember("such and such") ; saveVars() on it?
Re: Persistent Variables?
Posted: Sat Jan 02, 2010 11:00 pm
by Vadi
Only use remember once, it will get the values of stuff when it does saveVars(). and just do saveVars once in your quit trigger or something.
Re: Persistent Variables?
Posted: Sat Feb 13, 2010 6:56 pm
by Tsara
I have the impression remember is not recursive which means if your data contains a table of tables of tables you need to remember all childs individually, that or I am doing something wrong.
Re: Persistent Variables?
Posted: Sat Feb 13, 2010 7:29 pm
by Vadi
Personally I use table.save and table.load (
http://mudlet.org/asciidoc/manual.html#tablesave) along with getMudletHomeDir (
http://mudlet.org/asciidoc/manual.html#getMudletHomeDir) for data storage in scripts. See my name highlighter for an example.