我是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