Différences entre les versions de « Module:Common »

Aller à la navigation Aller à la recherche
115 octets ajoutés ,  23 octobre 2021 à 20:09
aucun résumé de modification
(Created page with "--[[ Additional functions that are common to other modules. As they cannot be outside of modules there is no invoke level function calls. ]] local function trim(object) -...")
 
Ligne 1 : Ligne 1 :
--[[  
--[[  
Additional functions that are common to other modules. As they cannot be
Additional functions that are common to other modules. Although they could
outside of modules there is no invoke level function calls.
be called into templates the overhead call into lua would generally greater
than using a built in mediawiki parser function where one exists.
]]
]]


local function trim(object)
local com = {}
 
function com.trim(object)
--Use of while instead of if incase multiple whitespaces are present.
--Use of while instead of if incase multiple whitespaces are present.
while string.sub(object, 1, 1) == ' ' do  
while string.sub(object, 1, 1) == ' ' do  
Ligne 17 : Ligne 20 :
end
end


function exists(object)
function com.exists(object)
if object == nil or object == '' then
if object == nil or object == '' then
return false
return false
Ligne 24 : Ligne 27 :
end
end
end
end
return com
1 124

modifications

Menu de navigation