Rick Posted December 12, 2011 Posted December 12, 2011 Josh, are you using lua_newthread(L) in the editor or engine when calling the Lua script? I ran into an issue where coroutines are failing in Lua possibly because you are using lua_newthread(L) instead of lua_newcthread(). I guess in LuaJIT if you use lua_newcthread() it will allow coroutines to work in the situation where the Lua script is going back and forth from Lua to DLL. My Question on the issue and others response http://stackoverflow.com/questions/8459459/lua-coroutine-error-tempt-to-yield-across-metamethod-c-call-boundary/8463031#comment10471100_8463031 A response related to the issue http://lua-users.org/lists/lua-l/2011-10/msg00461.html Note that before you switched to LuaJIT I was able to get coroutines to work in Lua. Coroutines can be very valuable as it basically gives us a form of threading via Lua. I was trying to use it to split up pathfinding between game cycles when I encountered the error I describe in the stackoverflow question. Quote
Josh Posted December 12, 2011 Posted December 12, 2011 I don't use threading with Newton at all, so neither are called as far as I know. Quote My job is to make tools you love, with the features you want, and performance you can't live without.
Rick Posted December 12, 2011 Author Posted December 12, 2011 I'll see if I can find out more information around this, but coroutines are a built-in feature of Lua and pretty powerful stuff so it would be nice if we were able to use them within LE's Lua implementation. Quote
Josh Posted December 13, 2011 Posted December 13, 2011 I agree, they are useful. Just make sure none of the elements in your loop change. Quote My job is to make tools you love, with the features you want, and performance you can't live without.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.