Editing variables in another file

I have a module like this:

local M = {} M.num = 0 return M

In another file, I want to do this:

local module = require("M") -- Name of the module file module.num = 10 

In a third file when I check “module.num” it’s back to 0 again. What I’m trying to do is create some sort of " Constant" variable to hold the current highscore, unlocked levels, etc. 

That looks correct to me - if you restart the app the values will reset though.

Corona recently introduced a feature for saving and retrieving small amounts of data.

https://forums.coronalabs.com/topic/65652-from-the-blog-introducing-new-preference-storage-features/

“module” is a quasi reserved word in Lua much like “require” I would advise against using common names that are also Lua identifiers like “table”, “string” and so on.

See if changing that has any affect.

Rob

That looks correct to me - if you restart the app the values will reset though.

Corona recently introduced a feature for saving and retrieving small amounts of data.

https://forums.coronalabs.com/topic/65652-from-the-blog-introducing-new-preference-storage-features/

“module” is a quasi reserved word in Lua much like “require” I would advise against using common names that are also Lua identifiers like “table”, “string” and so on.

See if changing that has any affect.

Rob