„Modul:Benutzer:XanonymusX“ – Versionsunterschied
Erscheinungsbild
[gesichtete Version] | [ungesichtete Version] |
Inhalt gelöscht Inhalt hinzugefügt
Keine Bearbeitungszusammenfassung |
Keine Bearbeitungszusammenfassung |
||
Zeile 29: | Zeile 29: | ||
array[temp_count2] = {} |
array[temp_count2] = {} |
||
wikimedia = "" |
wikimedia = "" |
||
for i in string.gmatch(frame.args[ |
for i in string.gmatch(frame.args[6], "%S+") do |
||
if temp_count == collums then |
if temp_count == collums then |
||
temp_count = 0 |
temp_count = 0 |
||
Zeile 53: | Zeile 53: | ||
wikimedia = wikimedia.."||" |
wikimedia = wikimedia.."||" |
||
end |
end |
||
if j == ( |
if j == (sum_collum - 1) then |
||
sum = sum + array[k][j] |
sum = sum + array[k][j] |
||
end |
end |
||
Zeile 60: | Zeile 60: | ||
end |
end |
||
if |
if sum_collum > 0 then |
||
wikimedia = wikimedia.."| "..tostring(sum)..tostring(sum_collum) |
wikimedia = wikimedia.."| "..tostring(sum)..tostring(sum_collum) |
||
end |
end |
Version vom 23. März 2015, 01:08 Uhr
Die Dokumentation für dieses Modul kann unter Modul:Benutzer:XanonymusX/Doku erstellt werden
--
-- Created by IntelliJ IDEA.
-- User: patricklanzinger
-- Date: 17.03.15
-- Time: 00:24
-- To change this template use File | Settings | File Templates.
--
local tablemodule = {}
function tablemodule.iseven(frame)
if(frame.args[1] % 2 == 0) then
return 0
else
return 1
end
end
function tablemodule.createtable(frame)
rows = tonumber(frame.args[1])
collums = tonumber(frame.args[2])
color_odd = frame.args[3]
color_even = frame.args[4]
sum_collum = tonumber(frame.args[5])
sum = 0
temp_count = 0
temp_count2 = 0
array = {}
array[temp_count2] = {}
wikimedia = ""
for i in string.gmatch(frame.args[6], "%S+") do
if temp_count == collums then
temp_count = 0
temp_count2 = temp_count2 + 1
array[temp_count2] = {}
end
array[temp_count2][temp_count] = i
temp_count = temp_count + 1
end
for k = 0,(rows - 1),1 do
if (k % 2) == 0 then
wikimedia = wikimedia.."|-style=\"background-color:"..color_even.."\"\n|"
else
wikimedia = wikimedia.."|-style=\"background-color:"..color_odd.."\"\n|"
end
for j = 0,(collums - 1), 1 do
x = array[k][j]
if j == (collums - 1) then
wikimedia = wikimedia..tostring(x).."\n"
else
wikimedia = wikimedia..tostring(x)
wikimedia = wikimedia.."||"
end
if j == (sum_collum - 1) then
sum = sum + array[k][j]
end
end
end
if sum_collum > 0 then
wikimedia = wikimedia.."| "..tostring(sum)..tostring(sum_collum)
end
return wikimedia
end
return tablemodule