Discord
Login
Community
DARK THEME

How to get the contents of all files in a category

system.project.listFiles("source", function(list) for item in list print(system.project.readFile("source/" + item.name, function(result) print(result) end)) end print("------------------------------") end)

will list the contents of all code files separated by ------------------------------. If you want to get something like sprites, all you need to do is change the two cases of "source" appearing in the code.

system.project.listFiles("sprites", function(list) for item in list print(system.project.readFile("sprites/" + item.name, function(result) print(result) end)) end print("------------------------------") end)

And here is a cleaned-up example of what's going on:

system.project.listFiles("source", 
   function(list) 
      for item in list
         print(system.project.readFile("source/" + item.name,
            function(result)
               print(result) 
            end
         )) 
      end
      print("------------------------------")
   end
)

Thx for the example =)

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community