Module:GameData: Difference between revisionsGive feedback
Create GameData module for generic cross-dataset entity filtering (with help from vergir-bot LLM) |
Remove Upgrades skip in find_value so abilities gaining charges via upgrades are included (with help from vergir-bot LLM) |
||
| Line 25: | Line 25: | ||
end | end | ||
-- Recursively searches a record for a given key at any nesting level | -- Recursively searches a record for a given key at any nesting level, | ||
-- | -- including inside the Upgrades array. This means abilities or items that | ||
-- | -- only gain a property via an upgrade tier will still be matched. | ||
-- @param record table the data record to search | -- @param record table the data record to search | ||
-- @param key string the internal property name to look for | -- @param key string the internal property name to look for | ||
| Line 33: | Line 33: | ||
local function find_value(record, key) | local function find_value(record, key) | ||
for k, v in pairs(record) do | for k, v in pairs(record) do | ||
if | if k == key then | ||
return v | return v | ||
elseif type(v) == "table" then | elseif type(v) == "table" then | ||