模块:换行处理
来自Gal中文百科
更多操作
Hello, world!
242
55
24
脚本错误:函数“img”不存在。
local p = {}
function p.text(frame)
local args = frame.args
local variable = args['变量'] or ''
-- 检查参数是否为空
if variable then
return 'Hello, world!\n' ..addBrTags(variable)
else
return 'Hello, world!'
end
end
function addBrTags(text)
-- 将换行符替换为 <br> 标签
local newText = string.gsub(text, "\n", "<br>")
return newText
end
return p