Module:Chat: Difference between revisions

From Growtopia
Jump to navigationJump to search
>NekoPillow
Test
 
>NekoPillow
No edit summary
 
(15 intermediate revisions by the same user not shown)
Line 1: Line 1:
getmetatable('').__index = function(str,i) return string.sub(str,i,i) end
local chat = {}
local chat = {}


function chat.parse(frame)
function chat.parse(input)
    local str = frame.args[1]
if(not type(input) == "string") then input1 = frame.args[1] else input1 = input end
     str:gsub("`[0-9wobpqertas!@#$^&`]",function(c)
input1 = input1:gsub("<CR>", "<br>")
local count = 0
     local output1 = (input1:gsub("`[0-9wobpqertasc!@#$^&`]",function(c)
        local code = c:sub(2,2)
          
          
         return c[1]
         if(code=="`") then
     end)
            if(count == 0) then return false end
            count = count-1
            return "</span>"
        end
        count = count+1
 
        return "<span style='"..code.."'>"
     end))
      
      
     return str
     return output1..string.rep("</span>",count)
end
end


return chat
return chat

Latest revision as of 16:10, 10 July 2025

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

local chat = {}

function chat.parse(input)
	if(not type(input) == "string") then input1 = frame.args[1] else input1 = input end
		
	input1 = input1:gsub("<CR>", "<br>")
	
	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