Allow functions for mobs_debug

This commit is contained in:
cora 2024-08-31 16:40:14 +02:00
parent 4fc7e61f28
commit 1ab378b248

View File

@ -29,7 +29,11 @@ function mcl_mobs.mob_class:get_nametag()
local name = self.nametag ~= "" and self.nametag or self.name local name = self.nametag ~= "" and self.nametag or self.name
local elements = {} local elements = {}
for _, k in ipairs(mcl_mobs_debug.fields_default) do for _, k in ipairs(mcl_mobs_debug.fields_default) do
table.insert(elements, k.." = "..tostring(self[k])) if type(k) =="function" then
table.insert(elements, k(self))
else
table.insert(elements, k.." = "..tostring(self[k]))
end
end end
for _, k in ipairs(self._debug_fields or {}) do for _, k in ipairs(self._debug_fields or {}) do
if type(k) == "function" then if type(k) == "function" then