diff --git a/castor.json b/castor.json index ccbc165..17661b5 100644 --- a/castor.json +++ b/castor.json @@ -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": [] } \ No newline at end of file diff --git a/scripts/lua/logging.lua b/scripts/lua/logging.lua new file mode 100644 index 0000000..60ab24d --- /dev/null +++ b/scripts/lua/logging.lua @@ -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 \ No newline at end of file diff --git a/scripts/lua/try.lua b/scripts/lua/try.lua index a1293dd..5e7c50e 100644 --- a/scripts/lua/try.lua +++ b/scripts/lua/try.lua @@ -1,3 +1,5 @@ +include "scripts/lua/logging.lua" + --- Function for try-catching --- @param func function function try(func) @@ -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