如何打破一个大的lua字符串成小的

我有一个大字符串(一个base64编码的图像),它是1050个字符长。如何在C中附加一个由小的字符串构成的大字符串
function GetIcon()
    return "Bigggg string 1"\
"continuation of string"\
"continuation of string"\
"End of string"

解决方法

根据 Programming in Lua 2.4 Strings

We can delimit literal strings also by matching double square brackets [[…]]. Literals in this bracketed form may run for several lines,may nest,and do not interpret escape sequences. Moreover,this form ignores the first character of the string when this character is a newline. This form is especially convenient for writing strings that contain program pieces; for instance,

page = [[
<HTML>
<HEAD>
<TITLE>An HTML Page</TITLE>
</HEAD>
<BODY>
 <A HREF="http://www.lua.org">Lua</A>
 [[a text between double brackets]]
</BODY>
</HTML>
]]

这是最接近你要求的东西,但是使用上面的方法可以将换行符嵌入到字符串中,所以这不会直接工作。

您也可以使用字符串连接(使用..):

value = "long text that" ..
      " I want to carry over" ..
      "onto multiple lines"

相关文章

1.github代码实践源代码是lua脚本语言,下载th之后运行thmai...
此文为搬运帖,原帖地址https://www.cnblogs.com/zwywilliam/...
Rime输入法通过定义lua文件,可以实现获取当前时间日期的功能...
localfunctiongenerate_action(params)localscale_action=cc...
2022年1月11日13:57:45 官方:https://opm.openresty.org/官...
在Lua中的table(表),就像c#中的HashMap(哈希表),key和...