What is the best way to save variables (and tables) to a file? Especially considering multidimensional tables.
I've tried using the remember() function from luaGlobal.lua, but it doesn't seem to be working.
How to save variables to file
Re: How to save variables to file
remember("VariableName")
saveVars()
the quotes are important, you have to pass remember() the name of your variable as a string, not the variable itself. To load 'em back up:
loadVars()
There're other ways, but this method does work.
saveVars()
the quotes are important, you have to pass remember() the name of your variable as a string, not the variable itself. To load 'em back up:
loadVars()
There're other ways, but this method does work.
Re: How to save variables to file
Ah, I didn't know you had to call saveVars() and loadVars() explicitly, as the comments said they should only be used by Mudlet and I assumed they were called implicitly when you quit/start Mudlet.
Thanks!
Thanks!
Re: How to save variables to file
they are called automatically in the new 2.0 pre6 version you can download. I haven't seen any major bugs while using it, I suggest you try it out
Re: How to save variables to file
Well I dunno what I did, but for some reason they aren't called automagically for me in pre6 anymore
Re: How to save variables to file
The function saveVars() has never been called by Mudlet because this set of functions is not generic enough to be generally useful imho.
People have to take care of variable saving themselves and should use the general table.save()/table.load() backbone directly imho.
People have to take care of variable saving themselves and should use the general table.save()/table.load() backbone directly imho.