Saving table as lua file

I have a fairly large json file that is compiled on my server from php, the CMS is a custom wordpress backend and there is server-side functionality that creates the json file and zips it. My app checks if it needs it’s data updating on startup with a small timecode check and then downloads, unzips and decodes this json file if needed.

This works well and as expected, the actual download is fast enough because it’s zipped, but due to it’s size the process takes far too long and causes a loading delay that feels buggy. This is due to the json decode more than anything else and the delay happens every time the app starts up because of this.

My question :

Is there a nice way to save out a lua table as a file on my server straight from a  php   array which I can download to my app’s documents directory and then simply require it rather than loading a json file and decoding it every time? The reason I want this is because I suspect it would significantly speed things up.

I do not want to use SQLite because I have already got things how I want them with a custom php array and I also know that SQLite will be even slower on the corona side.

You can’t require a .lua file after the app has been built. Apple’s rules.

Is there a way that you don’t have to send the whole thing every time, just updated/new bits?

Rob

Hi Rob. Well it’s not sending or receiving data every time the app loads, as I say this only happens occasionally when an update is needed. The problem is the process of opening the local json file. I remember Lerg from Spiral Clouds once mentioning somewhere that it is possible to save and open tables to lua files rather than going via json… But I can’t find where I read that.

You can use Lua tables before you build your app.

Rob

You can’t require a .lua file after the app has been built. Apple’s rules.

Is there a way that you don’t have to send the whole thing every time, just updated/new bits?

Rob

Hi Rob. Well it’s not sending or receiving data every time the app loads, as I say this only happens occasionally when an update is needed. The problem is the process of opening the local json file. I remember Lerg from Spiral Clouds once mentioning somewhere that it is possible to save and open tables to lua files rather than going via json… But I can’t find where I read that.

You can use Lua tables before you build your app.

Rob