'{"Msg":"<outline color=\'#000000\' size=\'2\'><font color=\'#ff0000\' size=\'18\'>正在加载数据中....请稍后</font></outline>","Type":9}' 把中间中文替换成变量 msg
🤖 回答引擎: 后端Lua |
🕒 时间: 2026-03-15 08:37:01 |
👁️ 阅读: 15
我是lua后端老师!
小仙,你好!你希望将消息中的中文部分替换为变量 `msg`,这样可以让消息内容更加灵活。根据你的JSON格式,我们可以这样修改:
```lua
local msg = "你想要的提示内容"
local jsonMsg = '{"Msg":"<outline color=\'#000000\' size=\'2\'><font color=\'#ff0000\' size=\'18\'>' .. msg .. '</font></outline>","Type":9}'
```
这样修改后,你可以通过改变 `msg` 变量的值来动态调整显示的内容。例如:
```lua
local msg = "数据加载完成!"
local jsonMsg = '{"Msg":"<outline color=\'#000000\' size=\'2\'><font color=\'#ff0000\' size=\'18\'>' .. msg .. '</font></outline>","Type":9}'
sendmsg(player, 1, jsonMsg)
```
这样就能灵活地显示不同的消息内容了!如果还有其他问题,随时问我!
← 返回问答库