Help! Preference Library Error

I need to implement a high score feature for the game I’m working on for a class project. I need to be able to update lua files permanently to track high score. 

According to this page, using the preferences library and functionality would be the easiest option for Corona. However, when I try to require “preferences” I get a nasty error message (in the image below). 

What am I doing wrong? 

Snip20180430_2.png

Have you downloaded that library and dropped it in to the folder with your main.lua?  This is a community created module so we can’t provide direct support for it.  The error indicates that it can’t find the preference library.

I don’t know how old that library is, but we now have our own preferences library built in to the core under system.setPreferences() (https://docs.coronalabs.com/api/library/system/setPreferences.html), system.getPreference() (https://docs.coronalabs.com/api/library/system/getPreference.html) and system.deletePreferences() (https://docs.coronalabs.com/api/library/system/deletePreferences.html).  You might want to look at them instead.

Rob

Rob, I actually figured it out! I was pretty dumb, actually. I figured out I was getting that error before I was trying to require something that didn’t exist. I figured the preference module existed already in Corona just like widgets or physics. 

I eventually stumbled upon THIS page, which completely solved my problems! I only wish I found it sooner. Would have saved a lot of headaches. If you google search “save high scores corona sdk”, this page should be at the top, but it unfortunately doesn’t show up. 

Thanks for the help regardless! 

Have you downloaded that library and dropped it in to the folder with your main.lua?  This is a community created module so we can’t provide direct support for it.  The error indicates that it can’t find the preference library.

I don’t know how old that library is, but we now have our own preferences library built in to the core under system.setPreferences() (https://docs.coronalabs.com/api/library/system/setPreferences.html), system.getPreference() (https://docs.coronalabs.com/api/library/system/getPreference.html) and system.deletePreferences() (https://docs.coronalabs.com/api/library/system/deletePreferences.html).  You might want to look at them instead.

Rob

Rob, I actually figured it out! I was pretty dumb, actually. I figured out I was getting that error before I was trying to require something that didn’t exist. I figured the preference module existed already in Corona just like widgets or physics. 

I eventually stumbled upon THIS page, which completely solved my problems! I only wish I found it sooner. Would have saved a lot of headaches. If you google search “save high scores corona sdk”, this page should be at the top, but it unfortunately doesn’t show up. 

Thanks for the help regardless!