Lua: How to avoid Circular Requires

后端 未结 2 1249
萌比男神i
萌比男神i 2020-12-17 20:13

Problem

How can I avoid the following error from Lua 5.1 when attempting to do a circular require?

$ lua main.lua 
lua: ./bar.lua:1: loop or previo         


        
2条回答
  •  渐次进展
    2020-12-17 20:52

    Another way would to solve this issue would be to change the structure of the code and extract the "mutual" functionality into a third module, which both Foo and Bar would require.

提交回复
热议问题