Hi @Scott_Harrison ,
I have purchased Firestore Plugin. I can run sample code you uploaded to gitHub.
But i want to add data with hierarchical Lua table (table inside table).
For example : firestore.updateData("cities", "LA", {values={ {1,2,3},{4,5,6} } },listener )
When i run this line, it gives runtime error.
I have tried below method as well :
I am not sure but i can show you one example which is created from another app created with native iOS (swift) ,(See Screenshot ) i want to create same data structure on firestore with solar2D App. All data structure need to updated dynamically not manually.
Like every time user do a session → i need to create new Session data document with all the information. and it requires 2d arrays.
I will try json.encode with values table same as you suggested.
– I read this and looks like it’s the same concept used in native code.
How can we create a object(map) in lua and add an array (lua table) to it and pass to firestore ?
I see in screenshot that → values is array , 0 is Map and inside 0 all fields are numbers.
I just pushed out an update for better array support on iOS( and Mac), firestore.updateData("cities", "LA", {values={"test", "test1", "test2"} }, listener )
should work now
I have to use this same structure in firestore because other application from Native updating in same database (multiple application using same database on firestore, few applications are native , one application is created using solar2d native)
I don’t believe it’s possible to recreate that structure since nested array are not supported on Firestore. This is not plugin limitation but a firestore limit. You will have to work around by break up the array into a table of random key or just encode it as json
That’s true, i already read that post but i don’t know how i can create my own mapping solution ?
I mean how we can do with Solar2D table with your plugin ?
I am sure that there is some trick to create this nested array on firestore dynamically.
The plugin just converts your lua arrays and table to native counterpart and uploads them to firestore. You need to figure out how to convert your nested arrays lua to table.
Edit: as the stackoverflow pointed out there is no magic solution devs are essentially left to figure it out