Properybag class error

When I use the

propertyBag:GetFromDisk()  

I get this error:

attempt to call method ‘GetFromDisk’ (a nil value)

my code is:

local prop = require("property")  
local propertyBag = prop:init()  
   
--Properties created in memory  
propertyBag:setProperty("myNumber", 2)  
   
--Save this to the disk  
propertyBag:SaveToFile()  
   
--read saved data from Disk  
propertyBag:GetFromDisk()  
   
print ( propertyBag:getProperty ("myNumber" ))  

I can just delete that row and it works fine, but why is it written on other places in the forums? [import]uid: 24111 topic_id: 12729 reply_id: 312729[/import]

Hi,

I could be wrong but i think you need to use getFromFile. I think getFromDisk is old command. Again I could be wrong!

Mo [import]uid: 49236 topic_id: 12729 reply_id: 46671[/import]

Yeah that worked but what’s the difference between: having GetFromFile() and not having it? [import]uid: 24111 topic_id: 12729 reply_id: 46677[/import]

when you use
[lua]propertyBag:setProperty(“myNumber”, 2)[/lua]
the property is actually created in memory

and when you call
[lua] print ( propertyBag:getProperty (“myNumber” )) [/lua]
it is called from memory itself. to get it from disk you should use
[lua]GetFromFile() [/lua]

[import]uid: 71210 topic_id: 12729 reply_id: 46747[/import]