Omnimaga

Calculator Community => TI Calculators => Lua => Topic started by: pianoman on July 29, 2011, 01:05:27 pm

Title: How to save high scores in Lua
Post by: pianoman on July 29, 2011, 01:05:27 pm
^^That
I tried document.markChanged(), but it didn't save anything.
Title: Re: How to save high scores in Lua
Post by: Munchor on July 29, 2011, 01:08:24 pm
^^That
I tried document.markChanged(), but it didn't save anything.

You need to use var (http://wiki.inspired-lua.org/Category:var) so that you can store (var.store(()) variables forever. And markChanged() is only to warn the user that he must save, it doesn't actually save anything.

I learnt it by looking at code of other programs ;) To be precise, Pixel Escape.
Title: Re: How to save high scores in Lua
Post by: pianoman on July 29, 2011, 01:11:26 pm
Oh, ok, I'll take a look at the code for that. Thanks!
Title: Re: How to save high scores in Lua
Post by: Munchor on July 29, 2011, 02:09:33 pm
Oh, ok, I'll take a look at the code for that. Thanks!

It's actually very easy, don't forget to check #nspire-lua for additional help. I had the guys from there help me with this and I can also help you now.
Title: Re: How to save high scores in Lua
Post by: cypressx1 on July 30, 2011, 08:07:36 pm
l think var.monitor should also be used.
Title: Re: How to save high scores in Lua
Post by: calc84maniac on July 30, 2011, 08:10:57 pm
l think var.monitor should also be used.
Yep, to prevent the user from hacking into the high score ^^
Title: Re: How to save high scores in Lua
Post by: Adriweb on July 30, 2011, 10:11:54 pm
yep, definitely, on any non wanted var.change, you could rewrite it from a local lua copy :P
Title: Re: How to save high scores in Lua
Post by: cypressx1 on August 02, 2011, 07:51:32 am
all right
Title: Re: How to save high scores in Lua
Post by: Levak on August 04, 2011, 03:18:26 pm
A little bump for this topic to add a full and detailed answer :
http://www.inspired-lua.org/2011/08/save-a-high-score-without-cheating-possibility/

Title: Re: How to save high scores in Lua
Post by: Chockosta on August 12, 2011, 06:54:18 am
It's still quite easy to cheat...
You just have to
1. open the page sorter
2. cut (Ctrl+X) the Lua app
3. add a math editor
4. change your var
5. paste the Lua app

EDIT : I did not see the last part with on.save() and on.restore()... It makes my solution useless