Diferencia entre revisiones de «Módulo:Tablas»

función para agrupar; modifico el formato de la función tostring
Sin resumen de edición
Línea 11: Línea 11:
     for k,v in pairs(tabla) do
     for k,v in pairs(tabla) do
     if type(k) == 'string' then
     if type(k) == 'string' then
     k2='"' .. k .. '"'
     k2='["' .. k .. ']"'
     else
     else
     k2=k
     k2='[' .. k .. ']'
     end
     end
         if type(v)=='table' then
         if type(v)=='table' then
             resultado = resultado .. identacion .. k2 .. '= {' .. z.tostring(v,identacion .. '  ') .. identacion .. '}'
             resultado = resultado .. identacion .. k2 ' = {' .. z.tostring(v,identacion .. '  ') .. identacion .. '}'
         elseif type(v)=='string' then
         elseif type(v)=='string' then
         resultado = resultado .. identacion .. k2 .. '= "' .. v .. '"'
         resultado = resultado .. identacion .. k2 .. ' = "' .. v .. '"'
         else
         else
         resultado = resultado .. identacion .. k2 .. '= ' .. tostring(v)
         resultado = resultado .. identacion .. k2 .. ' = ' .. tostring(v)
         end
         end
     end
     end