Skip to content

Commit

Permalink
Merge pull request #20 from ZtModArchive/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Zt-freak authored Sep 29, 2021
2 parents c9387b0 + 1d58a66 commit bc9f0e6
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 2 deletions.
30 changes: 28 additions & 2 deletions castor.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,37 @@
{
"ArchiveName": "zzz-ArluqTools",
"RepoName": "ZtModArchive/ArluqTools",
"Author": "Apodemus",
"Version": "v2.2",
"Type": "package",
"License": "MIT License",
"Description": "This is a lua library that is an abstraction layer around ZT2's libraries.",
"Z2f": true,
"ZT2loc": "C:\\Program Files (x86)\\Microsoft Games\\Zoo Tycoon 2",
"IncludeFolders": [
"ai",
"awards",
"biomes",
"config",
"effects",
"entities",
"lang",
"locations",
"maps",
"materials",
"photochall",
"puzzles",
"scenario",
"scripts",
"ui"
"shared",
"tourdata",
"ui",
"world",
"xpinfo"
],
"ExcludeFolders": [
"modules"
]
],
"Dependencies": [],
"DevDependencies": []
}
26 changes: 26 additions & 0 deletions scripts/lua/logging.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
--- Logger class
log = {}

--- Log debug to output
--- @param message string
function log.debug (message)
print(os.date("[%Y-%m-%d %H:%M:%S] ") .. "[DEBUG] " .. message)
end

--- Log error to output
--- @param message string
function log.error (message)
print(os.date("[%Y-%m-%d %H:%M:%S] ") .. "[ERROR] " .. message)
end

--- Log info to output
--- @param message string
function log.info (message)
print(os.date("[%Y-%m-%d %H:%M:%S] ") .. "[INFO] " .. message)
end

--- Log warning to output
--- @param message string
function log.warn (message)
print(os.date("[%Y-%m-%d %H:%M:%S] ") .. "[WARN] " .. message)
end
4 changes: 4 additions & 0 deletions scripts/lua/try.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
include "scripts/lua/logging.lua"

--- Function for try-catching
--- @param func function
function try(func)
Expand All @@ -11,6 +13,8 @@ function try(func)
do
displayZooMessageTextWithZoom(string.sub(exception, i, i+increment-1), 1, 30)
end
-- Show exception in log output
log.error(exception)
end
end

Expand Down

0 comments on commit bc9f0e6

Please sign in to comment.