In case you missed it, as of Daily Build 619, subscribers can now place Lua scripts (with an exception of main.lua) in sub-folders within their project directory for iOS apps (doesn’t apply to Android apps just yet).
There’s a few important things to note, however. When using the require() function in Lua, slashes (“/”) are not supported when accessing files in sub-directories (as with usual file operations). Instead, you use a “.” to signify a directory level. This also means you cannot have a “.” in your module name.
Here’s an example of requiring “bar.lua” from a sub-folder named “foo” that’s located in your app’s project directory (aka “resource directory”):
local fooBar = require( "foo.bar" )
Once again, bar.lua, is placed in a folder named “foo”, so here’s what the directory structure might look like for the example above:
Once again, this currently only works for iOS apps, so all of your resource files still need to remain at the top-level for Android apps. Also, this feature requires—at minimum—build 2011.619, which only subscribers have access to at the moment via Daily Builds.
Subscribe today and get the latest features and bug fixes right way!