LUA export - integer export within an array using curly braces

Hi,

I’m trying to export an array of numbers from custom properties into a LUA file.

Google Photos

Can someone help me work out how I turn the exported data from this:

properties = {
            ["delay"] = "0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5",
            ["final_delay"] = "2,2,2,2,2,2,2,2",
            ["sequence"] = "3,1,3,1,3,1,3,1"
          }

Into this:

properties = {
           
            ["delay"] = {0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5},
            ["final_delay"] = {2,2,2,2,2,2,2,2},
            ["sequence"] = {3,1,3,1,3,1,3,1},
          }

For single integer values within custom properties the data gets exported correctly but for an array, I can’t work out how to export this data without setting it first as a string within Tiled, which then exports the data with quotes and not curly braces.

Any help or suggestions is appreciated.

Thanks.
Stoo

As of Tiled 1.11 there is still no native support for arrays in custom properties, and hence workarounds like using a string with comma-separated values are necessary (another workaround is numbering the properties like delay1, delay2, etc.).

For the upcoming Tiled 1.12 I’ve added support for list properties, which will be exported as desired in the Lua format. If you want to give this a try, I’d suggest you try a development build which you can get from here:

Your feedback is really appreciated and can help ensure a stable 1.12 release!

1 Like

Thanks Bjorn for getting back to me.
I’ll give the nightly build a try.
Sounds like the next release is going to have some cool updates! :smiling_face_with_sunglasses:

1 Like