【发布时间】:2018-04-25 20:32:53
【问题描述】:
我正在 TextButton 脚本中创建一个脚本,该脚本将检查 TextBox 是否包含表格中的任何单词或字符串。
text = script.Parent.Parent:WaitForChild('TextBox')
label = script.Parent.Parent:WaitForChild('TextLabel')
a = {'test1','test2','test3'}
script.Parent.MouseButton1Click:connect(function()
if string.match(text.Text, a) then
label.Text = "The word "..text.Text.." was found in the table."
else
label.Text = "The word "..text.Text.." was not found in the table."
end
end)
但它给出了一个错误 string expected, got table. from line 7 这是指行 if 字符串。匹配....
有没有办法获取表格中的所有文本?
正确的做法是什么?
【问题讨论】: