converting things to strings so they can be saved as projectdata or localdata

how does one convert a table, which in the specific axample i am looking at is a table of loaded images, into a string so that it can be saved as projectdata, and then back again so it can be loaded and used?

I’ll give you an example of how I did it in my project.

function splitAndSaveKMFilters()

local kmFiltersListString = ""
if kmFiltersList ~= nil then
    for i,v in ipairs(kmFiltersList) do
        kmFiltersListString = kmFiltersListString..v..","


function splitAndRestoreKMFilters()

local kmFiltersListString=readLocalData("kmFiltersList",kmFiltersList)
if type(kmFiltersListString) ~= "table" then
    for regionName in string.gmatch(kmFiltersListString,"[%a+%s%-]+") do


Now this only works if its more of a list as opposed to an array of data. But from here, you can get an idea on how to change it for other values other than straight strings from a table.

Easiest is to use a json library. It will convert a table to a string, and decode a table from a strnig. Here’s what I’m using and works well:

Hey @ruilov, that is a great library, it even worked on long nested tables out of the box.