【发布时间】:2021-03-24 10:30:03
【问题描述】:
到目前为止我所拥有的:
local msg = "hello hi hey"
local words = {}
for word in msg:gmatch("%S+") do
table.insert(words, word)
end
-- splits msg by every blank space and drops it in words
我想去掉 msg 中的第一个单词,并将其余单词保存为变量。我发现我可以使用table.remove(words, 1) 来删除第一个单词,但是如何将其余单词保存为变量?
【问题讨论】:
-
重复,你可以在这里找到你的答案:stackoverflow.com/questions/2779700/lua-split-into-words
标签: lua