Revision as of 20:03, 22 November 2014 editDePiep (talk | contribs)Extended confirmed users294,285 editsNo edit summary← Previous edit | Revision as of 22:02, 22 November 2014 edit undoPigsonthewing (talk | contribs)Autopatrolled, Event coordinators, Extended confirmed users, Page movers, File movers, IP block exemptions, New page reviewers, Pending changes reviewers, Rollbackers, Template editors266,061 editsm Reverted edits by DePiep (talk) to last version by JackmcbarnNext edit → | ||
Line 1: | Line 1: | ||
-- | |||
local p = {} | local p = {} | ||
⚫ | function p.test1() | ||
local getArgs = require('Module:Arguments').getArgs | |||
local gsub = string.gsub | |||
--local stats0 = { {"paramOne", 9}, {"paramTwo", 22} } | |||
local stats = { paramOne=11, paramTwo, paramThree=33, paramFour } | |||
local t = mw.title.getCurrentTitle() | |||
function p.echo(frame) | |||
local |
local nt = 'Mina nonsense page' | ||
return p._echo(args) | |||
end | |||
⚫ | function p. |
||
local ret = {} | local ret = {} | ||
⚫ | table.insert( ret, '1:' ) | ||
mw.log('ToLog. ' .. #stats .. ' = ' .. table.maxn(stats)) | |||
table.insert( ret, t.talkPageTitle.prefixedText ) | |||
table.insert( ret, tostring(t.exists) ) | |||
table.insert( ret, t.namespace) | |||
table.insert( ret, 'Q:' .. type(mw.site.contentNamespaces ) ) | |||
table.insert( ret, 'A:' .. type(mw.site.contentNamespaces ) ) | |||
table.insert( ret, 'P:' .. #mw.site.contentNamespaces) | |||
table.insert( ret, 'Z:' .. table.concat(mw.site.contentNamespaces ) ) | |||
local t2 = mw.site.namespaces | |||
for k, v in |
for k, v in ipairs(t2) do | ||
stats=-99 | |||
table.insert( ret, k .. ' = ' .. tostring(v.name) .. ' ' .. tostring(v.isContent) .. '<br/>') | |||
mw.log(k .. ': ' .. v) | |||
end | end | ||
table.insert(ret, 'M:' .. t2.name) | |||
stats.paramTwo = 200 | |||
table.insert(ret, 'M:' .. t2.name) | |||
stats.paramThree = 3003 | |||
--table.insert(ret, 'M:' .. t2.isContent) | |||
-- So: init in local definition. | |||
table.insert(ret, ' |
--table.insert(ret, 'M:' .. t2.isContent) | ||
for k, v in pairs(stats) do --report | |||
if true then | |||
⚫ | |||
return table.concat( ret, '; ') | |||
end | end | ||
t = mw.title.makeTitle( 14, nt, fragment, interwiki ) | |||
return 'Returning ret: ' .. table.concat(ret, ', ') .. '\nstats:' .. table.concat(stats, '; ') | |||
local comp = 'Main page' | |||
t = mw.title.makeTitle( 14, comp ) | |||
table.insert( ret, '2:' ) | |||
table.insert( ret, t.Text) | |||
table.insert( ret, t.talkPageTitle.prefixedText ) | |||
table.insert( ret, tostring(t.exists) ) | |||
table.insert( ret, t.namespace) | |||
table.insert( ret, 'Q' .. tostring( t:inNamespaces(0, 828, 14) ) ) | |||
table.insert( ret, '<br>---' ) | |||
---table.insert( ret, table.concat( mw.site.namespaces, ':ns:' ) ) | |||
end | end | ||
Revision as of 22:02, 22 November 2014
This is the module sandbox page for Module:Sandbox/DePiep. |
- Sandbox/DePiep/sandbox (edit · talk · history · links · /subpages · /doc · /doc edit · /sbox · /sbox diff · /test)
- Sandbox/DePiep (edit · talk · history · links · /subpages · /doc · /doc edit · /sbox · /sbox diff · /test)
- Sandbox/DePiep/cc (edit · talk · history · links · /subpages · /doc · /doc edit · /sbox · /sbox diff · /test)
Math2
abs
math.abs math.abs( x ) Returns the absolute value of x.
ceil
math.ceil math.ceil( x ) Returns the smallest integer larger than or equal to x.
floor
math.floor math.floor( x ) Returns the largest integer smaller than or equal to x.
deg
math.deg math.deg( x ) Returns the angle x (given in radians) in degrees.
rad
math.rad( x ) Returns the angle x (given in degrees) in radians.
exp
math.exp math.exp( x ) Returns the value e x {\displaystyle e^{x}} e^{x}.
frexp
math.frexp math.frexp( x ) Returns two values m and e such that:
If x is finite and non-zero: x = m × 2 e {\displaystyle x=m\times 2^{e}} x=m\times 2^{e}, e is an integer, and the absolute value of m is in the range [ 0.5 , 1 ) {\displaystyle [0.5,1)} [0.5,1) If x is zero: m and e are 0 If x is NaN or infinite: m is x and e is not specified
ldexp
math.ldexp math.ldexp( m, e ) Returns m × 2 e {\displaystyle m\times 2^{e}} m\times 2^{e} (e should be an integer). Returns the base-10 logarithm of x.
modf
math.modf math.modf( x ) Returns two numbers, the integral part of x and the fractional part of x. For example, math.modf( 1.25 ) yields 1, 0.25.
pow
math.pow( x, y ) Equivalent to x^y.
sqrt
math.sqrt( x ) Returns the square root of x. Equivalent to x^0.5.
huge
math.huge The value representing positive infinity; larger than or equal to any other numerical value.
pi
math.pi The value of π {\displaystyle \pi } \pi .
The above documentation is transcluded from Module:Sandbox/DePiep/doc. (edit | history)Editors can experiment in this module's sandbox (edit) and testcases (create) pages.
Add categories to the /doc subpage. Subpages of this module.
-- local p = {} function p.test1() local t = mw.title.getCurrentTitle() local nt = 'Mina nonsense page' local ret = {} table.insert( ret, '1:' ) table.insert( ret, t.talkPageTitle.prefixedText ) table.insert( ret, tostring(t.exists) ) table.insert( ret, t.namespace) table.insert( ret, 'Q:' .. type(mw.site.contentNamespaces ) ) table.insert( ret, 'A:' .. type(mw.site.contentNamespaces ) ) table.insert( ret, 'P:' .. #mw.site.contentNamespaces) table.insert( ret, 'Z:' .. table.concat(mw.site.contentNamespaces ) ) local t2 = mw.site.namespaces for k, v in ipairs(t2) do table.insert( ret, k .. ' = ' .. tostring(v.name) .. ' ' .. tostring(v.isContent) .. '<br/>') end table.insert(ret, 'M:' .. t2.name) table.insert(ret, 'M:' .. t2.name) --table.insert(ret, 'M:' .. t2.isContent) --table.insert(ret, 'M:' .. t2.isContent) if true then return table.concat( ret, '; ') end t = mw.title.makeTitle( 14, nt, fragment, interwiki ) local comp = 'Main page' t = mw.title.makeTitle( 14, comp ) table.insert( ret, '2:' ) table.insert( ret, t.Text) table.insert( ret, t.talkPageTitle.prefixedText ) table.insert( ret, tostring(t.exists) ) table.insert( ret, t.namespace) table.insert( ret, 'Q' .. tostring( t:inNamespaces(0, 828, 14) ) ) table.insert( ret, '<br>---' ) ---table.insert( ret, table.concat( mw.site.namespaces, ':ns:' ) ) end return pCategory: