解决“function or expression too complex”问题中的string.char

我在使用string.char时遇到了一个问题。在任何网站上查找后,发现这是由于堆栈框架的限制。

我的代码如下:

function tochar(str)
    if type(str) ~= 'string' then
        return nil
    end
    local Result = {}
    for i = 1,#str do
        table.insert(Result, string.byte(string.sub(str,i, i)))
    end
    return table.concat(Result,',')
end

Content = 'hello world'
local result = tochar(Content)
local data = 'local code = load(string.dump(load(string.char('..result..'))))()\n'

如果我的内容不太长,那就好了。但是如果我尝试使用太长的内容,错误会说functíon or expression too complex

有什么解决办法吗?或者,另一种代码,但具有我所需的相同目的?

感谢。

点赞