Hi
I'm really struggling in finding an answer to my problem
How do I read a folder and then I want to find a file inside that folder read with specific extensions like .obj or .bmp and to do things to those files with those extensions
here is my attempt
require "lfs"
input = io.open("test.txt","w")
for dir_elem in lfs.dir("test folder") do
local target = "test folder" .. "/" .. dir_elem
if lfs.attributes(target).mode == "file" then
if #dir_elem > 4 and dir_elem:sub(#dir_elem-3, #dir_elem) == ".obj" then
local file = io.open(target, "r")
--searches match for v character
for match in file:lines("v") do
--Writes GL_Vertex3f for every occurence of v
input:write(" GL_Vertex3f ")
end
for match in file:lines("%A") do
input:write("",match)
end
end
end
end