Template:ClassMatrix: Difference between revisions
No edit summary |
No edit summary |
||
Line 3: | Line 3: | ||
{{#lua: | {{#lua: | ||
local H = {}; | local H = {}; | ||
local T = {}; | |||
for id in stdin:gmatch("%w+") do | for id in stdin:gmatch("%w+") do | ||
str = string.sub(id,{{{2}}},{{{3}}}); | str = string.sub(id,{{{2}}},{{{3}}}); | ||
if (H[str] == nil) then H[str] = 1; | if (H[str] == nil) | ||
then H[str] = 1; table.insert(T, str); | |||
else H[str] = H[str] + 1; | else H[str] = H[str] + 1; | ||
end | end | ||
end | end | ||
table.sort( | table.sort(T); | ||
for | for i=1,table.getn(T) do | ||
print(k .. | local k = T[i]; | ||
print(k .. H[k]); | |||
end | end | ||
|{{#var:ALL}} | |{{#var:ALL}} | ||
}} | }} |
Revision as of 03:06, 18 December 2008
{{#lua:
local H = {}; local T = {}; for id in stdin:gmatch("%w+") do str = string.sub(id,{{{2}}},{{{3}}}); if (H[str] == nil) then H[str] = 1; table.insert(T, str); else H[str] = H[str] + 1; end end table.sort(T); for i=1,table.getn(T) do local k = T[i]; print(k .. H[k]); end
| }}