×
Create a new article
Write your page title here:
We currently have 22 articles on The Grand Library of Hylia. Type your article name above or click on one of the titles below and start writing!



The Grand Library of Hylia

Module:TextToZonaiRunes: Difference between revisions

No edit summary
No edit summary
Line 15: Line 15:
             limit = 1
             limit = 1
         }
         }
         local results = cargo.query("ZonaiRunes", queryFields, args)
         local items = cargo.query("ZonaiRunes", queryFields, args)
         for r = 1, #results do
         for r = 1, #items do
             local result = results[r]
             local item = items[r]
             result = result .. string.format("[[%s]]", result.imageName)
             result = result .. string.format("[[%s]]", item.imageName)
         end
         end
     end
     end

Revision as of 11:20, 28 December 2023

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

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

function p.textToZonaiRunes(frame)
    local getArgs = require('Module:Arguments').getArgs
    local args = getArgs(frame);
    local phrase = args[1]

    local result = ""
    for i = 1, #phrase do
        local c = phrase:sub(i,i)
        local queryFields = 'cipherCharacter=cipherCharacter,imageName=imageName'
        local args = {
            format = 'table',
            limit = 1
        }
        local items = cargo.query("ZonaiRunes", queryFields, args)
        for r = 1, #items do
            local item = items[r]
            result = result .. string.format("[[%s]]", item.imageName)
        end
    end

    return result
end

return p