Lua: preemtive (not cooperative) multitasking in Lua with thread-like structures
问题 I was wondering whether Lua has any preemptive multitasking facilities built-in. I would like to have concurrent threads to use on my multi-core system. I looked into coroutines (see lua-users.org/wiki/CoroutinesTutorial and stackoverflow.com/questions/3107165/there-is-a-type-named-thread-in-lua-does-anyone-know-something-of-this), but it seems not to fit the bill. I wrote the following code: function foo(ver) local iter = 1; while true do print("foo ver="..ver.." iter="..iter); iter = iter +