Modul:HelloWorld: Unterschied zwischen den Versionen
Aus SchnuppTrupp
K |
K |
||
| Zeile 7: | Zeile 7: | ||
return 'Hallo, ' .. name .. '! Dies ist Lua!' | return 'Hallo, ' .. name .. '! Dies ist Lua!' | ||
end | end | ||
| + | function p.len(frame) | ||
| + | local value = frame.args[1] | ||
| + | local count = strlen (value) | ||
| + | return 'Das Wort ' .. value .. ' hat ' .. count .. ' Buchstaben' | ||
| + | end | ||
return p | return p | ||
Version vom 24. September 2015, 20:19 Uhr
Die Dokumentation für dieses Modul kann unter Modul:HelloWorld/Doku erstellt werden
local p = {}
function p.hello(frame)
local name = frame.args[1]
if not name then
name = 'Welt'
end
return 'Hallo, ' .. name .. '! Dies ist Lua!'
end
function p.len(frame)
local value = frame.args[1]
local count = strlen (value)
return 'Das Wort ' .. value .. ' hat ' .. count .. ' Buchstaben'
end
return p