Skip to content

Commit

Permalink
Use debug name in logs for nil strings
Browse files Browse the repository at this point in the history
  • Loading branch information
charliefoxtwo committed Oct 9, 2023
1 parent e389058 commit 6053d1e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Scripts/DCS-BIOS/lib/modules/memory_map/StringAllocation.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down

0 comments on commit 6053d1e

Please sign in to comment.