Modul:Common: Unterschied zwischen den Versionen

Aus FürthWiki
Zur Navigation springen Zur Suche springen
 
Zeile 18: Zeile 18:
  
 
function split(s, d)
 
function split(s, d)
 +
if d==nil then d="%s" end
 +
 
arr={}
 
arr={}
 
n=0
 
n=0
 
for i in string.gmatch(date, "[^"..d.."]+") do
 
for i in string.gmatch(date, "[^"..d.."]+") do
 +
arr[n]=i
 
n=n+1
 
n=n+1
arr[n]=i
 
 
end
 
end
 
return arr
 
return arr

Aktuelle Version vom 5. September 2024, 19:39 Uhr

Das Commons-Modul ist ein reines Import-Modul, welches immer wieder kehrende Funktionen beinhaltet, die über das Ganze Projekt hinweg immer wieder gebraucht werden.


local p = {}

function p.AttributeTable(args)
	-- Draws a simple Table that contains all arguments that are fed from the
	-- template to the scribunto-model. For debugging only!
	t='<table class="wikitable">'
	for i, v in pairs(args) do
		t = t .. '<tr><td>[[Attribut:' .. i .. '|' .. i .. ']]</td>' ..
				 '<td>' .. v .. '</td></tr>'
	end
	t = t .. '</table>'
	return t
end

function isEmpty(a)
	return a == '' or a == nil
end

function split(s, d)
	if d==nil then d="%s" end
	
	arr={}
	n=0
	for i in string.gmatch(date, "[^"..d.."]+") do
		arr[n]=i
		n=n+1
	end
	return arr
end

return p