Module:Grammar: Difference between revisions

From Caves of Qud Wiki
Jump to navigation Jump to search
No edit summary
 
mNo edit summary
Line 8: Line 8:
     if (type == "player") then
     if (type == "player") then
         outstring = "(player's " .. subtype .. ")"
         outstring = "(player's " .. subtype .. ")"
     elseif (type == "person") then
     elseif (type == "pronouns") then
         local args = {
         local args = {
           fields = subtype,
           fields = subtype,

Revision as of 19:54, 30 July 2019


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