guix Posted January 16, 2013 Posted January 16, 2013 There is a protection in Lua that prevent infinite loops from blocking the server forever. Sometimes (when testing things) you may need a huge loop that you know will not be infinite, but unfortunately it could still trigger that protection, so here is how to disable it temporarily: local h1, h2, h3 = debug.gethook() debug.sethook() -- Your loop here debug.sethook( _, h1, h2, h3 ) I hope it will be useful for someone else
myonlake Posted January 17, 2013 Posted January 17, 2013 Instead of explaining its surface and giving us the code, could you explain us what happens in the code. If I helped you, please click the like button on the right Thanks!
guix Posted January 17, 2013 Author Posted January 17, 2013 Not much to explain, it just store the hook state prior to disabling it, and restore it when the loop completed. I can't explain more because I don't know to be honest
Callum Posted January 23, 2013 Posted January 23, 2013 A more sensible approach would be to make use of timers. Set a very frequent timer and execute the loop in portions. Your method will simply stall the server and all players will eventually time out. Retired
Feche1320 Posted November 21, 2014 Posted November 21, 2014 A more sensible approach would be to make use of timers. Set a very frequent timer and execute the loop in portions. Your method will simply stall the server and all players will eventually time out. It depends on the use, I just used it to import +2000000 mysql rows to a sqlite database. Thanks to OP www.host-ar.com.ar
Recommended Posts