Die Dokumentation für dieses Modul kann unter Modul:Benutzer:Vollbracht/Spielwiese/stringFkt/Doku erstellt werden
local p = {
test = function(frame)
local s = frame.args[1]
local result = {string[frame.args[2]](s,
frame.args[3], frame.args[4], frame.args[5], frame.args[6])}
for i, v in ipairs(result) do
if type(v) == 'boolean' then
if v then result[i] = 'r' .. i .. ' is true'
else result[i] = 'r' .. i .. ' is false' end
elseif type(v) == 'string' then
result[i] = 'r' .. i .. ' is "' .. v .. '"'
elseif type(v) == 'number' then
result[i] = 'r' .. i .. ' = ' .. v
elseif type(v) == 'function' then
result[i] = 'r' .. i .. ' is a function'
elseif type(v) == 'table' then
local s = tostring(v)
if s then
result[i] = 'r' .. i .. ' looks like ' .. s
else
result[i] = 'r' .. i .. ' cannot be shown as a string'
end
else
result[i] = 'r' .. i .. ' has an unknown data type'
end
end
return table.concat(result, '<br />')
end
}
return p