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