Module:Grammar

From Caves of Qud Wiki
Revision as of 19:54, 30 July 2019 by Teamtoto (talk | contribs)
Jump to navigation Jump to search

local p = {}
local cargo = mw.ext.cargo

function p.parse(frame)
tables = 'Pronouns'

local a = string.gsub(frame.args[1], "(%w*)([:.])(%w*)", function(type,_,subtype)
    if (type == "player") then
        outstring = "(player's " .. subtype .. ")"
    elseif (type == "pronouns") then
        local args = {
          fields = subtype,
          where = 'pronoun=\"' .. frame.args[2] .. '\"',
          format = 'template',
          template = 'single query result'
        }
        local outstring = cargo.query(tables,fields,args)
        return outstring
    elseif (type == "verb") then
        return "{{Grammar|subtype|plural}}"
    else 
        return "ERROR: Could not parse!"
    end
return outstring
end)
return a
end

return p