模块:换行处理:修订间差异
来自Gal中文百科
更多操作
无编辑摘要 |
无编辑摘要 |
||
| 第5行: | 第5行: | ||
local jsxx= args['角色信息'] | local jsxx= args['角色信息'] | ||
-- 检查参数是否为空 | -- 检查参数是否为空 | ||
if | if jsxx then | ||
return 'Hello, world!\n' ..addBrTags(jsxx) | return 'Hello, world!\n' ..addBrTags(jsxx) | ||
else | else | ||
2024年4月3日 (三) 09:45的版本
Hello, world! 脚本错误:函数“img”不存在。
local p = {}
function p.text(frame)
local args = frame.args
local jsxx= args['角色信息']
-- 检查参数是否为空
if jsxx then
return 'Hello, world!\n' ..addBrTags(jsxx)
else
return 'Hello, world!'
end
end
function addBrTags(text)
-- 将换行符替换为 <br> 标签
local newText = string.gsub(text, "\n", "<br>")
return newText
end
return p