Módulo:PetOutfitsVisualizer: mudanças entre as edições

De TibiaRPGBrasil Wiki
Ir para navegação Ir para pesquisar
Sem resumo de edição
Sem resumo de edição
Linha 1: Linha 1:
local p = {}
local p = {}


string.explode = function (str, sep)
function explode(str, sep)
if(type(sep) ~= 'string' or isInArray({tostring(str):len(), sep:len()}, 0)) then
if(type(sep) ~= 'string' or isInArray({tostring(str):len(), sep:len()}, 0)) then
return {}
return {}
Linha 21: Linha 21:


function p.render(frame)
function p.render(frame)
     local outfits = frame.args.outfits:explode(";")
     local outfits = explode(frame.args.outfits,";")
     return outfits
     return outfits
end
end


return p
return p

Edição das 18h56min de 16 de agosto de 2025

A documentação para este módulo pode ser criada em Módulo:PetOutfitsVisualizer/doc

local p = {}

function explode(str, sep)
	if(type(sep) ~= 'string' or isInArray({tostring(str):len(), sep:len()}, 0)) then
		return {}
	end

	local i, pos, tmp, t = 0, 1, "", {}
	for s, e in function() return string.find(str, sep, pos) end do
		tmp = str:sub(pos, s - 1):trim()
		table.insert(t, tmp)
		pos = e + 1

		i = i + 1
	end

	tmp = str:sub(pos):trim()
	table.insert(t, tmp)
	return t
end

function p.render(frame)
    local outfits = explode(frame.args.outfits,";")
    return outfits
end

return p