I use a game engine that allows you to program in Lua. The game engine commands are located in a DLL created from C. In C, an exe is created that calls the Lua file. In this Lua file, you put all of your game code, including the main loop. There is no going back and forth with exe, but you can call functions from a DLL.
So, here, before the main loop, I create a function from which I am going to create a coroutine. This function iterates over a rather large table, so every n iterations I give way. This function has an infinite while loop, because I need this stuff to run each cycle of the main game loop, but it is normal if it is split between several cycles.
Then I create a coroutine with this function as a parameter. In the main game loop, I resume this coroutine.
When I run my code, I get an error: the temptation to exit through the metamethod / C-call border
I read some materials on the Internet, but did not understand what the problem was. As soon as exe names the Lua file, it does not return to exe at all until the Lua file is finished, and since I have my main loop in the Lua file, it never ends in my test case.
What are my options with this?
source share