使用部分字符串lua查找完整字符串 [英] Find full string using partial string lua
本文介绍了使用部分字符串lua查找完整字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图在表中查找整个字符串而不写完整的字符串.
I tried to find the whole string in a table without writing the full string.
示例:
maintable = {"SecondString", "FirstString"}
c = "First"
我如何能够使用字符串c
来查找FirstString的整个名称而无需键入整个字符串的名称?
How would I be able to use string c
to find the whole name of FirstString without typing the whole string name?
推荐答案
您必须搜索表:
for k,v in pairs(maintable) do
if v:match(c) then print(k,v) end
end
这篇关于使用部分字符串lua查找完整字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文