• [BUG] Crash any Sandbox server's timers
    1 replies, posted
The current timer.Check function is far too fragile. A single error in any timer will break the CheckTimers hook, stopping all further timers from executing. Gmod12's timer module wrapped timer function calls in pcall's with ErrorNoHalt to prevent such catastrophies, but the current version of timer.Check does not do this. Garry has repeatedly said "Well then fix the errors", but that is not a realistic approach to a system allowing lua addons. There is a default Gmod SENT that, when spawned with "Activate when Damaged" ticked, if its damaged and removed within 5 seconds, it'll hit a Null entity and crash CheckTimers. While yes, you should fix the SENT's timer, the real problem is CheckTimers being so easily crashable. [B]To fix:[/B] [CODE]-- timer.Check -- //value.Func() -- Current method, crashes the hook if theres an error local success, msg = pcall(value.Func) -- Gmod12 method (still works), will not ruin all timers if not success then ErrorNoHalt("Timer error ("..tostring(key).."): "..msg) end[/CODE] Or if you prefer, /lua/includes/modules/[URL="http://nebtown.info/showcase/timer.lua"]timer.lua[/URL]
'"Well then fix the errors" [...] is not a realistic approach to a system allowing lua addons.' I second that.
Sorry, you need to Log In to post a reply to this thread.