Module:Chat: Difference between revisions
From Growtopia
Jump to navigationJump to search
>NekoPillow No edit summary |
>NekoPillow mNo edit summary |
||
| Line 2: | Line 2: | ||
function chat.parse(frame) | function chat.parse(frame) | ||
local | local input = frame.args[1] | ||
local count = 0 | |||
local output = (input:gsub("`[0-9wobpqertas!@#$^&`]",function(c) | |||
local code = c:sub(2,2) | local code = c:sub(2,2) | ||
if(code == "`") then return "</span>" end | if(code == "`") then | ||
count = count - 1 | |||
return "</span>" | |||
end | |||
count = count + 1 | |||
return "<span style='"..code.."'>" | return "<span style='"..code.."'>" | ||
end)) | end)) | ||
return output:rep("</span>",count) | |||
end | end | ||
return chat | return chat | ||
Revision as of 05:14, 24 January 2019
Documentation for this module may be created at Module:Chat/doc
local chat = {}
function chat.parse(frame)
local input = frame.args[1]
local count = 0
local output = (input:gsub("`[0-9wobpqertas!@#$^&`]",function(c)
local code = c:sub(2,2)
if(code == "`") then
count = count - 1
return "</span>"
end
count = count + 1
return "<span style='"..code.."'>"
end))
return output:rep("</span>",count)
end
return chat