使用部分字符串 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屋!
查看全文