I want to know if anyone has a method for passing variables between modules.
I know how to call functions between modules, but lets say I have a variable (like a score) that is being constantly updated and I want to be able to use that variable for some purpose in the code of another module. Is this possible?
main: scores.number = 2
What this demonstrated to me was what had been stated here, although I wasn’t sure about the data sharing. Once main.lua had required scores.lua, any additional modules which require scores.lua get the same copy, and any variable which gets updated in scores.lua is visible to all modules which require it as the same variable and value. This is just a simple way to share data, and I don’t intend to compare it with Ice, but I was glad to find that it worked as a “singleton”.
[import]uid: 22076 topic_id: 19528 reply_id: 75383[/import]