Modul:Test
Aus SchnuppTrupp
Die Dokumentation für dieses Modul kann unter Modul:Test/Doku erstellt werden
local p = {} function p.hello(frame) return 'Ich will, dass hier etwas steht! [[Korbis Baustelle5]]' end function p.test(frame) return 'Und hier soll auch etwas stehen!' end function p.variables() local variable = 1 variable = variable + 1 return variable end function p.arithmetic() local a = 3 local b = 2 local result result = ';Arithmetic\n' result = result .. ':a is ' .. a .. '\n' result = result .. ':b is ' .. b .. '\n' result = result .. ':a + b is ' .. a + b .. '\n' result = result .. ':a - b is ' .. a - b .. '\n' result = result .. ':a * b is ' .. a * b .. '\n' result = result .. ':a / b is ' .. a / b .. '\n' result = result .. ':a % b is ' .. a % b .. '\n' result = result .. ':a ^ b is ' .. a ^ b .. '\n' result = result .. ':-a is ' .. -a .. '\n' return result end function p.relational() local a = 3 local b = 2 local result result = ';Relational\n' result = result .. ':a is ' .. a .. '\n' result = result .. ':b is ' .. b .. '\n' result = result .. ':a == b is ' .. tostring(a == b) .. '\n' result = result .. ':a ~= b is ' .. tostring(a ~= b) .. '\n' result = result .. ':a < b is ' .. tostring(a < b) .. '\n' result = result .. ':a > b is ' .. tostring(a > b) .. '\n' result = result .. ':a <= b is ' .. tostring(a <= b) .. '\n' result = result .. ':a >= b is ' .. tostring(a >= b) .. '\n' return result end function p.logical() local a = 3 local b = 2 local result result = ';Logical\n' result = result .. ':a is ' .. a .. '\n' result = result .. ':b is ' .. b .. '\n' result = result .. ':a < b and b < a is ' .. tostring(a < b and b < a) .. '\n' result = result .. ':a < b or b < a is ' .. tostring(a < b or b < a) .. '\n' result = result .. ':a < b is ' .. tostring(a < b) .. '\n' result = result .. ':not (a < b) is ' .. tostring(not (a < b)) .. '\n' return result end function p.length() local string = 'This is a string' local result result = ';Length\n' result = result .. ':The length of "' .. string .. '" is ' .. #string return result end return p