Persistent Variables?

JerleMinara
Posts: 7
Joined: Sat Dec 05, 2009 12:56 am

Re: Persistent Variables?

Post 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")

User avatar
Alexander Divine
Posts: 65
Joined: Mon Dec 21, 2009 7:01 pm

Re: Persistent Variables?

Post 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?

User avatar
Vadi
Posts: 4852
Joined: Sat Mar 14, 2009 3:13 pm

Re: Persistent Variables?

Post 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.

Tsara
Posts: 6
Joined: Sat Feb 06, 2010 11:09 am

Re: Persistent Variables?

Post 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.
Last edited by Tsara on Sun Feb 14, 2010 9:42 am, edited 1 time in total.

User avatar
Vadi
Posts: 4852
Joined: Sat Mar 14, 2009 3:13 pm

Re: Persistent Variables?

Post 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.

Post Reply