Loading asset lua file from Documents dir

Hi,

I’m trying to move some of my app assets (images and image sheets) to a remote downloadable zip files to reduce app size. However, I encountered an issue when trying to load image sheet files from documents directory on Apple devices. This is because the image sheet is accompanied by a lua file that describes its content. When it was in the app resource directory, using ‘require <module_name>’ would load it properly, but require doesn’t allow to load lua files from documents directory. Is there a convenient method to read and parse lua file from documents directory without using require?

Thanks
Adi

Maybe I’m wrong, but that is not possible since you can’t download anything from the internet that “changes” the behaviour of your app once it is installed. So you can’t download and use that sprite data that way.

I see 2 ways to solve that: the first one is to save your sprite data on your resource folder and only download the images.

And the second one is to store your sprite data in a json file, depending of it contents, a simple json.decode would work.

Thanks. Yes, I was hoping to avoid such changes.

You can run downloaded lua files:
https://github.com/roaminggamer/RG_FreeStuff/raw/master/Products/patcher/patcher.zip

Docs: https://roaminggamer.github.io/RGDocs/pages/Plugins/patcher/

Warning: Not a plugin any longer. Just download code above and require ‘patcher.lua’ directly.

You may need to make direct tweaks to the module to get your usage case working. I can’t remember if I updated to handle downloaded spritesheets or not.

Thanks @roaminggamer, that’s a helpful utility. I’ll check it out.