Save the Value/State of a radio button in Preferences

Is there a way to save the state or value of a radio button in preferences? I have radio buttons controlling theme and language and I want to be able to save the state even when the user leaves the app. I know how to save text in preferences but I cant figure this out for some reason. Thanks!!

This is the same principle as the question you asked here:

  • Save the button values every time the user touches them.
  • On clean-restart, load the last saved values and toggle the buttons if needed after you create them.

The concept you’ve been struggling with between text fields and now buttons is called ‘serialization’.

e.g. Storing the state of some set of objects to be later restored.

Corona SDK / Solar2D does not have built-in display (or native) object serialization. You have to write your own code to do that as needed.

You can get a big headstart by using SSK’s table extensions and saving settings as JSON encoded tables.

You don’t need to rest of SSK. Just add my io., str., and table.* extensions to your project to save yourself a lot of effort.

Download the files (link above) and require them once in main.lua.

Here are the docs for those extensions: https://roaminggamer.github.io/RGDocs/pages/SSK2/extensions/