Jump to content

Module:OOO/Data

From Out of Ore Wiki
Revision as of 20:24, 6 October 2025 by T-Bone (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Documentation for this module may be created at Module:OOO/Data/doc

local M = {}

local buckets = {
  Buildings = mw.loadData('Module:OOO/Data/Buildings'),
  Vehicles  = mw.loadData('Module:OOO/Data/Vehicles'),
}

local function norm(id) return tostring(tonumber(id) or id) end

function M.get(domain, id)
  local t = domain and buckets[domain]
  if not t or not id then return nil end
  return t[norm(id)]
end

-- Optional convenience: "Domain:ID" (e.g., "Buildings:400113")
function M.lookup(key)
  local domain, id = tostring(key or ""):match("^([^:]+):(.+)$")
  if domain and id then return M.get(domain, id) end
  return nil
end

return M