我是Lua新手,所以我现在正在学习运算符部分。 有没有一个通配符可以在Lua中使用字符串?Lua比较运算符(通配符?)
我来自一个PHP的背景,我基本上是试图实现代码:
--scan the directory's files
for file in lfs.dir(doc_path) do
--> look for any files ending with .jpg
if file is like ".jpg" then
--do something if any files ending with .JPG are scanned
end
end
你会看到我在寻找出JPG文件,而我在一个目录循环通过的文件。 我习惯于使用百分比符号或星号字符来搜索字符串。 但也许Lua有不同的方式?
另外,我也完全符合陈述猜测:“如果文件是这样......”
优秀的解释。确切地说,我需要阅读 – coffeemonitor 2012-07-21 00:46:50