<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="es">
	<id>https://www.bioeticawiki.com/w/index.php?action=history&amp;feed=atom&amp;title=M%C3%B3dulo%3ATablas</id>
	<title>Módulo:Tablas - Historial de revisiones</title>
	<link rel="self" type="application/atom+xml" href="https://www.bioeticawiki.com/w/index.php?action=history&amp;feed=atom&amp;title=M%C3%B3dulo%3ATablas"/>
	<link rel="alternate" type="text/html" href="https://www.bioeticawiki.com/w/index.php?title=M%C3%B3dulo:Tablas&amp;action=history"/>
	<updated>2026-05-05T12:35:49Z</updated>
	<subtitle>Historial de revisiones de esta página en la wiki</subtitle>
	<generator>MediaWiki 1.37.0</generator>
	<entry>
		<id>https://www.bioeticawiki.com/w/index.php?title=M%C3%B3dulo:Tablas&amp;diff=103452&amp;oldid=prev</id>
		<title>Fjramiro: 1 revisión importada</title>
		<link rel="alternate" type="text/html" href="https://www.bioeticawiki.com/w/index.php?title=M%C3%B3dulo:Tablas&amp;diff=103452&amp;oldid=prev"/>
		<updated>2019-12-28T18:41:21Z</updated>

		<summary type="html">&lt;p&gt;1 revisión importada&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;es&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Revisión anterior&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revisión del 20:41 28 dic 2019&lt;/td&gt;
				&lt;/tr&gt;
&lt;!-- diff cache key w_bioeticawiki:diff::1.12:old-103451:rev-103452 --&gt;
&lt;/table&gt;</summary>
		<author><name>Fjramiro</name></author>
	</entry>
	<entry>
		<id>https://www.bioeticawiki.com/w/index.php?title=M%C3%B3dulo:Tablas&amp;diff=103451&amp;oldid=prev</id>
		<title>W&gt;Juan Mayordomo en 19:21 15 nov 2019</title>
		<link rel="alternate" type="text/html" href="https://www.bioeticawiki.com/w/index.php?title=M%C3%B3dulo:Tablas&amp;diff=103451&amp;oldid=prev"/>
		<updated>2019-11-15T19:21:05Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Página nueva&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local z = {}&lt;br /&gt;
&lt;br /&gt;
-- Código copiado de http://lua-users.org/wiki/SortedIteration&lt;br /&gt;
function __genOrderedIndex( t )&lt;br /&gt;
    local orderedIndex = {}&lt;br /&gt;
    for key in pairs(t) do&lt;br /&gt;
        table.insert( orderedIndex, key )&lt;br /&gt;
    end&lt;br /&gt;
    table.sort( orderedIndex )&lt;br /&gt;
    return orderedIndex&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function orderedNext(t, state)&lt;br /&gt;
    -- Equivalent of the next function, but returns the keys in the alphabetic&lt;br /&gt;
    -- order. We use a temporary ordered key table that is stored in the&lt;br /&gt;
    -- table being iterated.&lt;br /&gt;
&lt;br /&gt;
    local key = nil&lt;br /&gt;
    --print(&amp;quot;orderedNext: state = &amp;quot;..tostring(state) )&lt;br /&gt;
    if state == nil then&lt;br /&gt;
        -- the first time, generate the index&lt;br /&gt;
        t.__orderedIndex = __genOrderedIndex( t )&lt;br /&gt;
        key = t.__orderedIndex[1]&lt;br /&gt;
    else&lt;br /&gt;
        -- fetch the next value&lt;br /&gt;
        for i = 1,table.getn(t.__orderedIndex) do&lt;br /&gt;
            if t.__orderedIndex[i] == state then&lt;br /&gt;
                key = t.__orderedIndex[i+1]&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    if key then&lt;br /&gt;
        return key, t[key]&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    -- no more value to return, cleanup&lt;br /&gt;
    t.__orderedIndex = nil&lt;br /&gt;
    return&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function orderedPairs(t)&lt;br /&gt;
    -- Equivalent of the pairs() function on tables. Allows to iterate&lt;br /&gt;
    -- in order&lt;br /&gt;
    return orderedNext, t, nil&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function z.tostringordered(tabla, identacion)&lt;br /&gt;
    identacion = identacion or '\n'&lt;br /&gt;
    local identacion2 = identacion .. '  '&lt;br /&gt;
    &lt;br /&gt;
    if not tabla then&lt;br /&gt;
    	return&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    local valores = {}&lt;br /&gt;
    local k2, v2&lt;br /&gt;
 &lt;br /&gt;
    for k,v in orderedPairs(tabla) do&lt;br /&gt;
    	if type(k) == 'string' then&lt;br /&gt;
    		k2 = '&amp;quot;' .. k .. '&amp;quot;'&lt;br /&gt;
    	else&lt;br /&gt;
    		k2 = k&lt;br /&gt;
    	end&lt;br /&gt;
        if type(v) == 'table' then&lt;br /&gt;
            v2 = z.tostringordered(v, identacion2)&lt;br /&gt;
        elseif type(v)=='string' then&lt;br /&gt;
        	v2 = '&amp;quot;' .. v .. '&amp;quot;'&lt;br /&gt;
        else&lt;br /&gt;
        	v2 = tostring(v)&lt;br /&gt;
        end&lt;br /&gt;
        &lt;br /&gt;
        table.insert(valores, '[' .. k2 .. '] = ' .. v2)&lt;br /&gt;
    end&lt;br /&gt;
 &lt;br /&gt;
    return '{' .. identacion2 .. (table.concat(valores, ', ' .. identacion2) or '') .. identacion .. '}'&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function z.tostring(tabla, identacion)&lt;br /&gt;
    identacion = identacion or '\n'&lt;br /&gt;
    local identacion2 = identacion .. '  '&lt;br /&gt;
    &lt;br /&gt;
    if not tabla then&lt;br /&gt;
    	return&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    local valores = {}&lt;br /&gt;
    local k2, v2&lt;br /&gt;
 &lt;br /&gt;
    for k,v in pairs(tabla) do&lt;br /&gt;
    	if type(k) == 'string' then&lt;br /&gt;
    		k2 = '&amp;quot;' .. k .. '&amp;quot;'&lt;br /&gt;
    	else&lt;br /&gt;
    		k2 = k&lt;br /&gt;
    	end&lt;br /&gt;
        if type(v) == 'table' then&lt;br /&gt;
            v2 = z.tostring(v, identacion2)&lt;br /&gt;
        elseif type(v)=='string' then&lt;br /&gt;
        	v2 = '&amp;quot;' .. v .. '&amp;quot;'&lt;br /&gt;
        else&lt;br /&gt;
        	v2 = tostring(v)&lt;br /&gt;
        end&lt;br /&gt;
        &lt;br /&gt;
        table.insert(valores, '[' .. k2 .. '] = ' .. v2)&lt;br /&gt;
    end&lt;br /&gt;
 &lt;br /&gt;
    return '{' .. identacion2 .. (table.concat(valores, ', ' .. identacion2) or '') .. identacion .. '}'&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function z.elemento(tabla, indice1, indice2, indice3, indice4, indice5, indice6, indice7)&lt;br /&gt;
	local resultado&lt;br /&gt;
	&lt;br /&gt;
	if not tabla or not indice1 then&lt;br /&gt;
		return&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	resultado = tabla[indice1]&lt;br /&gt;
	&lt;br /&gt;
	if not indice2 or not resultado then&lt;br /&gt;
		return resultado&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	resultado = resultado[indice2]&lt;br /&gt;
&lt;br /&gt;
	if not indice3 or not resultado then&lt;br /&gt;
		return resultado&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	resultado = resultado[indice3]&lt;br /&gt;
	&lt;br /&gt;
	if not indice4 or not resultado then&lt;br /&gt;
		return resultado&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	resultado = resultado[indice4]&lt;br /&gt;
	&lt;br /&gt;
	if not indice5 or not resultado then&lt;br /&gt;
		return resultado&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	resultado = resultado[indice5]&lt;br /&gt;
	&lt;br /&gt;
	if not indice6 or not resultado then&lt;br /&gt;
		return resultado&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	resultado = resultado[indice6]&lt;br /&gt;
	&lt;br /&gt;
	if not indice7 or not resultado then&lt;br /&gt;
		return resultado&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	resultado = resultado[indice7]&lt;br /&gt;
	&lt;br /&gt;
	return resultado&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function z.en(tabla, elemento)&lt;br /&gt;
    if not elemento then&lt;br /&gt;
        return&lt;br /&gt;
    end&lt;br /&gt;
    for k,v in pairs( tabla ) do&lt;br /&gt;
        if v == elemento then&lt;br /&gt;
            return k&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function z.copiarElementosConValor(original)&lt;br /&gt;
	local copia= {}&lt;br /&gt;
	&lt;br /&gt;
    for k,v in pairs(original) do&lt;br /&gt;
        if v~='' then&lt;br /&gt;
            copia[k] = original[k]&lt;br /&gt;
        end&lt;br /&gt;
    end	&lt;br /&gt;
    &lt;br /&gt;
    return copia&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function z.insertar(tabla, elemento)&lt;br /&gt;
	if not elemento then&lt;br /&gt;
		return false&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if not z.en(tabla, elemento) then&lt;br /&gt;
		table.insert(tabla, elemento)	&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return true&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function z.insertarElementosConValor(origen, destino)&lt;br /&gt;
    for k,v in pairs(origen) do&lt;br /&gt;
        if v~='' then&lt;br /&gt;
            table.insert(destino, v)&lt;br /&gt;
        end&lt;br /&gt;
    end	&lt;br /&gt;
    &lt;br /&gt;
    return copia&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function z.sonIguales(tabla1, tabla2)&lt;br /&gt;
	if not tabla1 or not tabla2 then&lt;br /&gt;
		return false&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if tabla1 == tabla2 then&lt;br /&gt;
		return true&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	for k,v in pairs(tabla1) do&lt;br /&gt;
		if tabla2[k] ~= v then&lt;br /&gt;
			return false&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	for k,v in pairs(tabla2) do&lt;br /&gt;
		if not tabla1[k] then&lt;br /&gt;
			return false&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return true&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function z.ordenarFuncion(tabla, funcion)&lt;br /&gt;
	local funcionInestable = funcion&lt;br /&gt;
	&lt;br /&gt;
	-- Añadir a la tabla un campo con el orden&lt;br /&gt;
	for i,n in ipairs(tabla) do tabla[i].__orden = i end&lt;br /&gt;
	&lt;br /&gt;
	table.sort(tabla, &lt;br /&gt;
		function(a,b) &lt;br /&gt;
		   if     funcionInestable(a, b) then return true -- a &amp;lt; b&lt;br /&gt;
		   elseif funcionInestable(b, a) then return false -- b &amp;lt; a&lt;br /&gt;
		   elseif a.__orden &amp;lt; b.__orden  then return true -- a = b y a aparece antes que b&lt;br /&gt;
		   else                               return false -- a = b y b aparece antes que a&lt;br /&gt;
		   end&lt;br /&gt;
		end&lt;br /&gt;
	)&lt;br /&gt;
    &lt;br /&gt;
    -- Eliminar de la tabla el campo con el orden&lt;br /&gt;
	for i,n in ipairs(tabla) do tabla[i].__orden = nil end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function z.ordenar(tabla, criterio)&lt;br /&gt;
	if type(criterio) == 'table' then&lt;br /&gt;
		z.ordenarFuncion(tabla,&lt;br /&gt;
			function(a,b)&lt;br /&gt;
				local valorA, valorB&lt;br /&gt;
				for i,campo in ipairs(criterio) do&lt;br /&gt;
					valorA = a[campo]&lt;br /&gt;
					valorB = b[campo]&lt;br /&gt;
					if not valorA and not valorA then&lt;br /&gt;
						-- No hacer nada&lt;br /&gt;
					elseif not valorA and valorB then&lt;br /&gt;
						return true&lt;br /&gt;
					elseif valorA and not valorB then&lt;br /&gt;
						return false&lt;br /&gt;
					elseif valorA &amp;lt; valorB then&lt;br /&gt;
						return true&lt;br /&gt;
					elseif valorA &amp;gt; valorB then&lt;br /&gt;
						return false &lt;br /&gt;
					end&lt;br /&gt;
				end	&lt;br /&gt;
		   		return false -- Todos los valores son iguales&lt;br /&gt;
			end&lt;br /&gt;
		)	&lt;br /&gt;
	else&lt;br /&gt;
		z.ordenarFuncion(tabla, criterio)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function z.agrupar(tabla, clave, campo)&lt;br /&gt;
	local tabla2 = {}&lt;br /&gt;
	&lt;br /&gt;
	local v2&lt;br /&gt;
	&lt;br /&gt;
	for k,v in ipairs(tabla) do&lt;br /&gt;
		if not v[campo] then&lt;br /&gt;
			table.insert(tabla2, v)&lt;br /&gt;
			v2 = nil&lt;br /&gt;
		elseif v2 and v2[clave] == v[clave] then&lt;br /&gt;
			-- Agrupar&lt;br /&gt;
			table.insert(v2[campo], v[campo])&lt;br /&gt;
		else&lt;br /&gt;
			v2 = v&lt;br /&gt;
			v2[campo] = {v[campo]}	&lt;br /&gt;
			table.insert(tabla2, v2)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return tabla2&lt;br /&gt;
end&lt;br /&gt;
 &lt;br /&gt;
return z&lt;/div&gt;</summary>
		<author><name>W&gt;Juan Mayordomo</name></author>
	</entry>
</feed>