Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:Chat: Difference between revisions

From Growtopia Wiki
NekoPillow (talk | contribs)
No edit summary
NekoPillow (talk | contribs)
No edit summary
Line 4: Line 4:
function chat.parse(frame)
function chat.parse(frame)
     local input1 = frame.args[1]
     local input1 = frame.args[1]
     local count = 0
     return chat.parseM(input1)
end
 
function chat.parseM(input1)
local count = 0
     local output1 = (input1:gsub("`[0-9wobpqertasc!@#$^&`]",function(c)
     local output1 = (input1:gsub("`[0-9wobpqertasc!@#$^&`]",function(c)
         local code = c:sub(2,2)
         local code = c:sub(2,2)

Revision as of 16:03, 10 July 2025

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

local chat = {}


function chat.parse(frame)
    local input1 = frame.args[1]
    return chat.parseM(input1)
end

function chat.parseM(input1)
	local count = 0
    local output1 = (input1:gsub("`[0-9wobpqertasc!@#$^&`]",function(c)
        local code = c:sub(2,2)
        
        if(code=="`") then
            if(count == 0) then return false end
            count = count-1
            return "</span>"
        end
        count = count+1

        return "<span style='"..code.."'>"
    end))
    
    return output1..string.rep("</span>",count)
end

return chat