Is there a way to Require() a file from documents or temp directory? basically i want to download a file from a server and require it at runtime. Premise would be i have a framework app for a customer (a publisher possibly) then when we have a new app or game for them we can download it to the device and run it. [import]uid: 6317 topic_id: 18102 reply_id: 318102[/import]
I believe you would use:
-- If myFile.lua existed in your app's Documents directorylocal myFile = require( "Documents.myFile" )[/code]Now, in order to properly access the documents directory, you'd have to launch the app in the simulator first, go to File > Show Project Sandbox and drop the file in THAT Documents directory, not your project's folder. I would recommend just using your app's bundle though, it seems to complicated this way and doesn't really give you any benefits.Also, I'm not 100% sure the above code would work (since Documents directory is created at a different time and is not simply part of your project folder).But, for more information on requiring in Lua files in sub-directories, see this blog post:http://blog.anscamobile.com/2011/10/daily-build-feature-lua-files-in-folders/ [import]uid: 52430 topic_id: 18102 reply_id: 69271[/import]
(Edit OOPS clicked link out of e-mail and got this old thread)
Should have answered here instead:
http://developer.coronalabs.com/forum/2012/10/29/requiring-lua-file-documents-directory#comment-129069
I guess I need to read the dates before I answer. [import]uid: 110228 topic_id: 18102 reply_id: 129078[/import]
(Edit OOPS clicked link out of e-mail and got this old thread)
Should have answered here instead:
http://developer.coronalabs.com/forum/2012/10/29/requiring-lua-file-documents-directory#comment-129069
I guess I need to read the dates before I answer. [import]uid: 110228 topic_id: 18102 reply_id: 129078[/import]