WARFRAME Wiki
Advertisement
WARFRAME Wiki


Lua error in Module:Docbunto at line 922: documentation markup for Docbunto not found in Module:FactionScript.
Created with Docbunto

See Also

Code


--WARFRAME Grineer and Corpus Script Convertor
--http://warframe.wikia.com/wiki/Template:FactionScript

local p = {}

local CharData = mw.loadData( 'Module:FactionScript/data' )

function p.gen_script( faction, human_words, size )
    local output_string = {}
    local human_words = string.lower(human_words)
    local human_length = string.len(human_words)
    local char_data
    local human_char
    local replacement
    
    if faction == 'corpus' then
        char_data = CharData['CorpusChar']
        if (size == '') or (size == nil) then size = '14' end
        for i=1, human_length do
            human_char = human_words:sub(i,i)
            replacement = char_data[human_char]
            if replacement then
                table.insert(output_string, get_img(replacement, size))
            else
                table.insert(output_string,' ')
            end
        end
    else
        char_data = CharData['GrineerChar']
        if (size == '') or (size == nil) then size = '16' end
        for i=1, human_length do
            human_char = human_words:sub(i,i)
            if human_char == 'q' then
                table.insert(output_string,get_img(char_data['k'], size)..get_img(char_data['w'], size))
            elseif human_char == 'x' then
                table.insert(output_string,get_img(char_data['k'], size)..get_img(char_data['s'], size))
            else
                replacement = char_data[human_char]
                if replacement then
                    table.insert(output_string, get_img(replacement, size))
                else
                    table.insert(output_string,' ')
                end
            end
        end
    end
    return create_span(output_string, size)
end


function get_img(replacement, size)
    return '[[File:'..replacement..'|x'..size..'px|link=]]'
end

function create_span(output_string, size)
    local span = mw.html.create( 'span' )
    span:css( 'font-size', size..'px' )
        :wikitext( table.concat(output_string) )
    return tostring(span)
end


function p.corpus( frame )
    local string_input = frame.args[1]
    local num_input = frame.args[2]
    return p.gen_script('corpus', string_input, num_input)
end

function p.grineer( frame )
    local string_input = frame.args[1]
    local num_input = frame.args[2]
    return p.gen_script('grineer', string_input, num_input)
end

return p
Advertisement