guix Posted January 16, 2013 Share 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 Link to comment
myonlake Posted January 17, 2013 Share Posted January 17, 2013 Instead of explaining its surface and giving us the code, could you explain us what happens in the code. Link to comment
guix Posted January 17, 2013 Author Share 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 Link to comment
Callum Posted January 23, 2013 Share 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. Link to comment
Feche1320 Posted November 21, 2014 Share 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 Link to comment
Recommended Posts