From 22ee7ba1fbd97f7aacc130bcc7e9a8b258abe7d2 Mon Sep 17 00:00:00 2001 From: Quaggles Date: Thu, 25 May 2023 01:11:54 +1000 Subject: [PATCH] Fixed log writing when log.write was not available --- Hooks/DCS-LuaExporter-hook.lua | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Hooks/DCS-LuaExporter-hook.lua b/Hooks/DCS-LuaExporter-hook.lua index b47d5f54..3e8de7e0 100644 --- a/Hooks/DCS-LuaExporter-hook.lua +++ b/Hooks/DCS-LuaExporter-hook.lua @@ -1,6 +1,18 @@ local logName = 'DCS.Lua.Exporter' -local function debugLog(message) log.write(logName, log.INFO, tostring(message)) end -local function debugLogError(message) log.write(logName, log.ERROR, tostring(message)) end +local function debugLog(message) + if log.write ~= nil then + log.write(logName, log.INFO, message) + else + net.log("["..logName.."] ".."(INFO) "..message) + end +end +local function debugLogError(message) + if log.write ~= nil then + log.write(logName, log.ERROR, message) + else + net.log("["..logName.."] ".."(ERROR) "..message) + end +end local originalPackagePath = package.path package.path = package.path..";"..lfs.writedir().."Scripts/Hooks/?.lua" -- Saved Games Hooks package.path = package.path..";./Scripts/Hooks/?.lua" -- Game Directory Hooks