I’m trying to write some code that will trawl a directory for a bunch of lua files and load them using the require function. Like so:
[lua]
infodir=“autocode”
infoPrefix=“gen”
local path=system.pathForFile(nil,system.ResourceDirectory)
assert(lfs.chdir(path…"/"…infodir))
local pattern="^"…infoPrefix
for file in lfs.dir(lfs.currentdir()) do
if file:find(pattern) then
local name=file:sub(1,-5)
local m=require (infodir …"."…name)
…
end
end
[/lua]
However I’ve noticed that Corona packs all the lua files away somewhere, while preserving the project directory structure. I’m assuming all the Lua gets packed into the resources.car file. Is it possible to interrogate the SDK some other way for a list of lua files? Being able to programmatically load them is useful for auto generated code.