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 = {}


function explode(str, separator)
string.explode = function (str, sep)
    local result = {}
if(type(sep) ~= 'string' or isInArray({tostring(str):len(), sep:len()}, 0)) then
    for match in (str..separator):gmatch("(.-)"..separator) do
return {}
        table.insert(result, match)
end
    end
 
    return result
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
end


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


return p
return p

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

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

local p = {}

string.explode = function (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 = frame.args.outfitsexplode:explode(";")
    return outfits
end

return p