Skip to content

Commit a48740b

Browse files
committed
add rockspec
1 parent 241f276 commit a48740b

3 files changed

Lines changed: 436 additions & 419 deletions

File tree

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
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
2424
end

0 commit comments

Comments
 (0)