Module:Sandbox

From Wikiversity
Jump to: navigation, search

local p = {}

function p.abs(frame)
	local x = frame.args[1]
	return ';abs\n:math.abs(' .. x .. ') is ' .. math.abs(x) .. '\n'
end

function p.acos(frame)
	local x = frame.args[1]
	return ';acos\n:math.acos(' .. x .. ') is ' .. math.acos(x) .. '\n'
end

function p.asin(frame)
	local x = frame.args[1]
	return ';asin\n:math.asin(' .. x .. ') is ' .. math.asin(x) .. '\n'
end

function p.atan(frame)
	local x = frame.args[1]
	return ';atan\n:math.atan(' .. x .. ') is ' .. math.atan(x) .. '\n'
end

function p.atan2(frame)
	local x = frame.args[1]
	local y = frame.args[2]
	return ';atan2\n:math.atan2(' .. y .. ', ' .. x .. ') is ' .. math.atan2(y, x) .. '\n'
end

function p.ceil(frame)
	local x = frame.args[1]
	return ';ceil\n:math.ceil(' .. x .. ') is ' .. math.ceil(x) .. '\n'
end

function p.cos(frame)
	local x = frame.args[1]
	return ';cos\n:math.cos(' .. x .. ') is ' .. math.cos(x) .. '\n'
end

function p.cosh(frame)
	local x = frame.args[1]
	return ';cosh\n:math.cosh(' .. x .. ') is ' .. math.cosh(x) .. '\n'
end

function p.deg(frame)
	local x = frame.args[1]
	return ';deg\n:math.deg(' .. x .. ') is ' .. math.deg(x) .. '\n'
end

function p.exp(frame)
	local x = frame.args[1]
	return ';exp\n:math.exp(' .. x .. ') is ' .. math.exp(x) .. '\n'
end

function p.floor(frame)
	local x = frame.args[1]
	return ';floor\n:math.floor(' .. x .. ') is ' .. math.floor(x) .. '\n'
end

function p.fmod(frame)
	local x = frame.args[1]
	local y = frame.args[2]
	return ';fmod\n:math.fmod(' .. x .. ', ' .. y .. ') is ' .. math.fmod(x, y) .. '\n'
end

function p.frexp(frame)
	local x = frame.args[1]
	return ';frexp\n:math.frexp(' .. x .. ') is ' .. math.frexp(x) .. '\n'
end

function p.huge()
	return ';huge\n:math.huge is ' .. math.huge .. '\n'
end

function p.ldexp(frame)
	local m = frame.args[1]
	local e = frame.args[2]
	return ';ldexp\n:math.ldexp(' .. m .. ', ' .. e .. ') is ' .. math.ldexp(m, e) .. '\n'
end

function p.log(frame)
	local x = frame.args[1]
	return ';log\n:math.log(' .. x .. ') is ' .. math.log(x) .. '\n'
end

function p.log10(frame)
	local x = frame.args[1]
	return ';log10\n:math.log10(' .. x .. ') is ' .. math.log10(x) .. '\n'
end

function p.max(frame)
	local x = frame.args[1]
	local y = frame.args[2]
	return ';max\n:math.max(' .. x .. ', ' .. y .. ') is ' .. math.max(x, y) .. '\n'
end

function p.min(frame)
	local x = frame.args[1]
	local y = frame.args[2]
	return ';min\n:math.min(' .. x .. ', ' .. y .. ') is ' .. math.min(x, y) .. '\n'
end

function p.modf(frame)
	local x = frame.args[1]
	return ';modf\n:math.modf(' .. x .. ') is ' .. math.modf(x) .. '\n'
end

function p.pi()
	return ';pi\n:math.pi is ' .. math.pi .. '\n'
end

function p.pow(frame)
	local x = frame.args[1]
	local y = frame.args[2]
	return ';pow\n:math.pow(' .. x .. ', ' .. y .. ') is ' .. math.pow(x, y) .. '\n'
end

function p.rad(frame)
	local x = frame.args[1]
	return ';rad\n:math.rad(' .. x .. ') is ' .. math.rad(x) .. '\n'
end

function p.random(frame)
	local m = frame.args[1]
	local n = frame.args[2]
	return ';random\n:math.random(' .. m .. ', ' .. n .. ') is ' .. math.random(m, n) .. '\n'
end

function p.randomseed(frame)
	local m = frame.args[1]
	local n = frame.args[2]
	math.randomseed(os.time())
	return ';randomseed\n:math.random(' .. m .. ', ' .. n .. ') is ' .. math.random(m, n) .. '\n'
end

function p.sin(frame)
	local x = frame.args[1]
	return ';sin\n:math.sin(' .. x .. ') is ' .. math.sin(x) .. '\n'
end

function p.sinh(frame)
	local x = frame.args[1]
	return ';sinh\n:math.sinh(' .. x .. ') is ' .. math.sinh(x) .. '\n'
end

function p.sqrt(frame)
	local x = frame.args[1]
	return ';sqrt\n:math.sqrt(' .. x .. ') is ' .. math.sqrt(x) .. '\n'
end

function p.tan(frame)
	local x = frame.args[1]
	return ';tan\n:math.tan(' .. x .. ') is ' .. math.tan(x) .. '\n'
end

function p.tanh(frame)
	local x = frame.args[1]
	return ';tanh\n:math.tanh(' .. x .. ') is ' .. math.tanh(x) .. '\n'
end

return p