1- --- Function for try-catching
2- --- @param func function
3- function try (func )
4- -- Try
5- local status , exception = pcall (func )
6- -- Catch
7- if not status then
8- -- Show exception in the message panel in-game
9- displayZooMessageTextWithZoom (" Exception: " .. exception , 1 , 30 )
10- end
11- end
12-
13- --- Function for try-catching with a custom callback
14- --- @param func function
15- --- @param callback function
16- function tryCatch (func , callback )
17- -- Try
18- local status , exception = pcall (func )
19- -- Catch
20- if not status then
21- -- Call callback function
22- callback (exception )
23- end
1+ --- Function for try-catching
2+ --- @param func function
3+ function try (func )
4+ -- Try
5+ local status , exception = pcall (func )
6+ -- Catch
7+ if not status then
8+ -- Show exception in the message panel in-game
9+ displayZooMessageTextWithZoom (" Exception: " .. exception , 1 , 30 )
10+ end
11+ end
12+
13+ --- Function for try-catching with a custom callback
14+ --- @param func function
15+ --- @param callback function
16+ function tryCatch (func , callback )
17+ -- Try
18+ local status , exception = pcall (func )
19+ -- Catch
20+ if not status then
21+ -- Call callback function
22+ callback (exception )
23+ end
2424end
0 commit comments