Lua table to javascript array.

Just wanted to add a javascript tab to some work I am doing, what I have done is create a table with the data convert to string

luup.variable_set(ELK_SID, "TroubleReport",(table.concat(troubleList,",")), lug_device)

then at the javascript end I have dropped the string straight into an array.

trouble = new Array(troubleReportList);

Currently I only have one item in the list so can’t test and was hoping someone could tell me if this works with multiple entries?

Thanks

John

I think it’s

trouble =  JSON.parse( "[" + troubleReportList + "]" )

in JavaScript as long as each member of troubleReportList is formatted like a JSON object. See this link: [url=http://www.w3schools.com/json/json_eval.asp]http://www.w3schools.com/json/json_eval.asp[/url]

watou

@watou
Thanks, went for “split” but will give this a try.

Cheers

John