From 6053d1e584f41febb9f65f11f495b84d698be02a Mon Sep 17 00:00:00 2001 From: Charlie <30303272+charliefoxtwo@users.noreply.github.com> Date: Sun, 8 Oct 2023 23:06:27 -0700 Subject: [PATCH] Use debug name in logs for nil strings --- .../DCS-BIOS/lib/modules/memory_map/StringAllocation.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Scripts/DCS-BIOS/lib/modules/memory_map/StringAllocation.lua b/Scripts/DCS-BIOS/lib/modules/memory_map/StringAllocation.lua index 67eb2ae86..ebc4ad646 100644 --- a/Scripts/DCS-BIOS/lib/modules/memory_map/StringAllocation.lua +++ b/Scripts/DCS-BIOS/lib/modules/memory_map/StringAllocation.lua @@ -6,18 +6,21 @@ local Log = require("Log") --- @field address integer the memory address --- @field maxLength integer the maximum length of the string --- @field characterAllocations MemoryAllocation[] the memory allocations which make up the string +--- @field debug_name string? the human-readable name to display for this allocation in logs local StringAllocation = {} --- Constructs a new StringAllocation --- @param characterAllocations MemoryAllocation[] the memory allocations which make up the string --- @param max_length integer the maximum length of the string +--- @param debug_name string? the human-readable name to display for this allocation in logs --- @return StringAllocation -function StringAllocation:new(characterAllocations, max_length) +function StringAllocation:new(characterAllocations, max_length, debug_name) --- @type StringAllocation local o = { address = characterAllocations[1].address, maxLength = max_length, characterAllocations = characterAllocations, + debug_name = debug_name, } setmetatable(o, self) self.__index = self @@ -30,7 +33,7 @@ function StringAllocation:setValue(value) local i = 1 if value == nil then - Log:log(string.format("Util.lua: item is sending a nil value")) + Log:log(string.format("Util.lua: string for %s is sending a nil value", self.debug_name)) return end