Question

I am programming a game in Lua based Corona that requires that I require a module inside of another module. I am getting a looping error. The reason I am doing it this way is because I need to use a function that I have defined in main.lua in a module that itself is required in main.lua. To solve that problem, I decided I would hold my game state in a separate module called gameState.lua. But then, I get the circular requirement error. Is there any way to get around this in Corona SDK?

Was it helpful?

Solution

I need to use a function that I have defined in main.lua in a module that itself is required in main.lua.

Move that function out to a third module and require it in the other two.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top