I have created a class called Property (shall be available soon to download) this class allows for creating properties like NSUserDefaults in Memory and also being able to persist them to the disk.
So the way it will work is
local prop = require("property")
local propertyBag = prop:init()
--Properties created in memory
propertyBag:setProperty("MyName", "Jayant C Varma")
propertyBag:setProperty("MyCompany", "OZ Apps")
propertyBag:setProperty("myURL", "www.oz-apps.com")
--Now let us save this to the disk
propertyBag:SaveToFile()
--Let us change the URL to ReviewMe
propertyBag:setProperty ( "myURL", "reviewme.oz-apps.com" )
--NOTE that the url is changed but it is only in memory, not saved to disk as yet
print ( propertyBag:getProperty ("myURL" )
--Let us revert back to the saved data from Disk
propertyBag:GetFromDisk()
print ( propertyBag:getProperty ("myURL" )
That is how easy it will be to use, so you can save anything you want. Scores, items, filenames or any data that you can and want to refer to with a name.
I shall release it once I work on it a bit more, I am trying to set the Default values, like in NSUserDefaults, so you might call the getProperty as
[code]
print ( propertyBag:getProperty( “nothing” , “not as yet defined” ) )
–This shall create the property and set the value of nothing to the default value provided and this shall be an optional value
[/code] [import]uid: 3826 topic_id: 7651 reply_id: 27167[/import]