Benutzer:Silvicola/modules/Modul:Hello

aus Wikipedia, der freien Enzyklopädie
Zur Navigation springen Zur Suche springen

local p = {} function p.hello(frame)

   separator = "&"
   outstring =""

--[[wie es nicht geht:

   for k, v in frame.args do 
   for k, v in frame:args do 
   for k, v in frame:args() do  -- args ist Feld, nicht Funktion

--]] -- so geht's:

   for k, v in frame:argumentPairs() do 
       if  outstring ~= "" then
           outstring = outstring .. separator
       end
       outstring = outstring .. "(" .. k .. ", " .. v .. ")"
   end
   return outstring

end

return p

--[[ function p.hello(frame)

   separator = "*"
   outString =  separator
   i = 1     
   while frame.args[i] do
     outString = outString .. frame.args[i] .. separator
     i = i + 1
     if i > 5 then
       break
     end
   end
   return  outString

end --]]