If a.lua does a require(“b”) and b.lua does a require(“a”) I get this error:
loop or previous error loading module
But I legitimately need a.lua to call some functions in b, and vice-versa. Am I missing something? [import]uid: 92621 topic_id: 25837 reply_id: 325837[/import]
Try to rethink your code structure.
If A relies on B, and B relies on A, in a way that one can`t load independently first, then it should throw up a red flag.
It`s hard to provide useful solutions to help that structure, but possibly creating a third Utilities class that contains some of the required functions, or possibly allowing A to entirely contain B. These are wild guesses, as I don’t know what A and B are supposed to do.
You cannot in Lua have A.lua load B.lua and B.lua load A.lua due to how files are parsed and interpreted (it would create an infinite loop and crash, because it would be never be able to finish loading A or B)
If you give a bit more context maybe me or someone else could provide a different stucture/design that would remove the issue. [import]uid: 134101 topic_id: 25837 reply_id: 104535[/import]