Module:OD
Documentation for this module may be created at Module:OD/doc
local od = {}
local depressants = {"opiates", "benzodiazepines", "barbiturates", "gabapentinoids", "thienodiazepines", "alcohol", "GABAergics"}
local wiki = {
opiates = "[[opiates]]",
alcohol = "[[alcohol]]",
barbiturates = "[[barbiturates]]",
benzodiazepines = "[[benzodiazepines]]",
gabapentinoids = "[[gabapentinoids]]",
thienodiazepines = "[[thienodiazepines]]",
GABAergics = "[[GABA#GABA_receptors|GABAergic substances]]"
}
function od.wikilink(frame)
local d = frame.args[1] == "benzos" and "benzodiazepines" or frame.args[1]
if d == "alcohol" then return wiki[d] .. " is"
else return wiki[d] .. " are" end
end
function od.otherDepressants(frame)
local others = {}
local p = frame.args[1] == "benzos" and "benzodiazepines" or frame.args[1]
for _,d in pairs(depressants) do
if d == p then -- do nothing, since p shouldn't be printed
elseif d == "GABAergics" then table.insert(others, "other " .. wiki[d])
else table.insert(others, wiki[d]) end
end
return mw.text.listToText(others, ", ", " or ")
end
return od