Difference between revisions of "Module:Sandbox"

From Pathfinder Wiki
 
(24 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
local p = {}
 
local p = {}
 +
local utilities = require ( "Module:Utilities" )
  
 
function p.expandTemplate( frame )
 
function p.expandTemplate( frame )
Line 6: Line 7:
  
 
function p.lst( frame )
 
function p.lst( frame )
 +
mw.log('Test')
 
local strFromTrans = frame:callParserFunction( '#lst', { 'Localization:All/de', 'LoremIpsum' })
 
local strFromTrans = frame:callParserFunction( '#lst', { 'Localization:All/de', 'LoremIpsum' })
mw.log('strFromTrans: '..strFromTrans)
+
mw.log('strFromTrans: |'..strFromTrans..'|')
 +
end
 +
 
 +
function p.testLocalize( frame )
 +
local retVal = utilities.localize( 'Requirements' )
 +
mw.log('retVal: '..retVal)
 +
end
 +
 
 +
function p.variableScope( frame )
 +
if ( globalVar == nil ) then
 +
mw.log( 'globalVar == nil')
 +
end
 +
globalVar = 'test'
 +
mw.log('globalVar: '..globalVar)
 +
end
 +
 
 +
function p.toNumber( frame )
 +
local str = frame.args[1]
 +
mw.log('string: '..str)
 +
number = tonumber(string.match(str, '%d+'))
 +
--number = tonumber(str)
 +
if (number ~= nil) then
 +
mw.log('number: '..number)
 +
else
 +
mw.log('number is nil')
 +
end
 +
end
 +
 
 +
 
 +
function p.callInputTest( frame )
 +
inputTest('calledTest')
 +
end
 +
 
 +
function inputTest(inString)
 +
mw.log(inString)
 +
inString = 'Hello World'
 +
mw.log(inString)
 +
end
 +
 
 +
function p.preprocess(frame)
 +
mw.log('|'..tostring(frame.args[1])..'|')
 +
return frame:preprocess('[[Master Guide/Prerequisites'..frame.args[1]..']]')
 
end
 
end
  
 
return p
 
return p

Latest revision as of 16:15, 30 January 2022

Documentation for this module may be created at Module:Sandbox/doc

local p = {}
local utilities = require ( "Module:Utilities" )

function p.expandTemplate( frame )
	mw.log(frame:expandTemplate{ title = 'User:DesignerThan/Sandbox/expandTemplate' })
end

function p.lst( frame )
	mw.log('Test')
	local strFromTrans = frame:callParserFunction( '#lst', { 'Localization:All/de', 'LoremIpsum' })
	mw.log('strFromTrans: |'..strFromTrans..'|')
end

function p.testLocalize( frame )
	local retVal = utilities.localize( 'Requirements' )
	mw.log('retVal: '..retVal)
end

function p.variableScope( frame )
	if ( globalVar == nil ) then
		mw.log( 'globalVar == nil')
	end
	globalVar = 'test'
	mw.log('globalVar: '..globalVar)
end

function p.toNumber( frame )
	local str = frame.args[1]
	mw.log('string: '..str)
	number = tonumber(string.match(str, '%d+'))
	--number = tonumber(str)
	if (number ~= nil) then
		mw.log('number: '..number)
	else
		mw.log('number is nil')
	end
end


function p.callInputTest( frame )
	inputTest('calledTest')
end

function inputTest(inString)
	mw.log(inString)
	inString = 'Hello World'
	mw.log(inString)
end

function p.preprocess(frame)
	mw.log('|'..tostring(frame.args[1])..'|')
	return frame:preprocess('[[Master Guide/Prerequisites'..frame.args[1]..']]')
end

return p