Modul:HelloWorld: Unterschied zwischen den Versionen
Aus SchnuppTrupp
(Die Seite wurde neu angelegt: „function Hello(my_string) print (my_string) end“) |
K |
||
| (4 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt) | |||
| Zeile 1: | Zeile 1: | ||
| − | function | + | 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 = string.len(value) | ||
| + | return 'Das Wort ' .. value .. ' hat ' .. count .. ' Buchstaben' | ||
end | end | ||
| + | return p | ||
Aktuelle Version vom 24. September 2015, 20:24 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 = string.len(value)
return 'Das Wort ' .. value .. ' hat ' .. count .. ' Buchstaben'
end
return p