Modul:Test: Unterschied zwischen den Versionen

Aus STA Dokumentationsplattform
Zur Navigation springen Zur Suche springen
Zeile 2: Zeile 2:
  
 
local p = {};  
 
local p = {};  
 +
 +
 +
p.getLabel = function (frame)
 +
local id = frame.args.id
 +
local label = wikibase.getLabel( id )
 +
return label
 +
end
  
 
p.hello = function( frame )  
 
p.hello = function( frame )  

Version vom 20. Mai 2020, 19:32 Uhr

Die Dokumentation für dieses Modul kann unter Modul:Test/Doku erstellt werden

-- Das Modul enthält einige Testfunktionen, um das Skripting mit Lua zu erproben

local p = {}; 


p.getLabel = function (frame)
 local id = frame.args.id
 local label = wikibase.getLabel( id )
 return label
end

p.hello = function( frame ) 
  local str = "Hello World!" 
  return str
end

function p.hello_to(frame)
  local name = frame.args[1]
  return "Hello, " .. name .. "!" 
end

function p.count_fruit(frame)
	local num_bananas = frame.args.bananas 
	local num_apples = frame.args.apples  
										   
	return 'I have ' .. num_bananas .. ' bananas and ' .. num_apples .. ' apples'							
end

return p