想要删除Lua中parantheses中字符串之间的空格

Ana*_*san 2 string lua lua-table

我试图删除parantheses中的字符串之间的空格.但是它给出了函数的地址.

str = "1791 (AR6K Async) S 2 0 0 0 -1 2129984 0 0 0 0 0 113 0 0 20 0 1 0 2370 0 0 4294967295 0 0 0 0 0 0 0 2147483647 0 3221520956 0 0 17 0 0 0 0 0 0 0 0 0 0 0 0 0 0"

local word = str:gmatch("%(%S+)%" , "")
print(word)
Run Code Online (Sandbox Code Playgroud)

在上面这个字符串中,我只想要除了paranthesis空间以外的所有东西.我试图得到像下面的输出没有任何空格的paranthesis.

"1791 (AR6KAsync) S 2 0 0 0 -1 2129984 0 0 0 0 0 113 0 0 20 0 1 0 2370 0 0 4294967295 0 0 0 0 0 0 0 2147483647 0 3221520956 0 0 17 0 0 0 0 0 0 0 0 0 0 0 0 0 0"
Run Code Online (Sandbox Code Playgroud)

请帮我解决这个问题.

Ego*_*off 5

str = "1791 (AR6K Async) S 2 0 0 0 -1 2129984 0 0 0 0 0 113 0 0 20 0 1 0 2370 0 0 4294967295 0 0 0 0 0 0 0 2147483647 0 3221520956 0 0 17 0 0 0 0 0 0 0 0 0 0 0 0 0 0"

str2 = str:gsub("%b()" , function(s) return (s:gsub("%s", "")) end)
print(str2)
Run Code Online (Sandbox Code Playgroud)

说明:
1.使用Lua模式遍历括号内的所有字符串"%b()"
2.使用删除这些字符串中的所有空格:gsub("%s", "")