Reputation: 31
I'm currently making a game in Godot using CSV tables to help keep track of things. Most stuff works, except when I want to import a column as an array. How would I format this array in a CSV so that it imports like this?
"["Civ (Fishing)","Civ (Trade)","Civ (Transport)"]"
I think the plugin I'm using to import CSVs automatically puts double quotes around the array, which is fine, as I can convert an array as a string to a regular array, but it keeps messing up and does this:
"[\"Civ (Fishing)\",\"Civ (Trade)\",\"Civ (Transport)\"]"
if I do this:
"["Civ (Fishing)","Civ (Trade)","Civ (Transport)"]"
and it does this:
"[Civ (Fishing)", "Civ (Trade)", "Civ (Transport)]"
if I do this:
[Civ (Fishing),Civ (Trade),Civ (Transport)]
I think this is less a Godot problem and more a CSV one. I saw that there's the whole double quote to escape double quote thing, but I'm not sure where to put it those quotes here.
Any help would be appreciated!
Upvotes: 1
Views: 91
Reputation: 31
Never mind, I'm just...le dumb.
While it DOES import this
"["Civ (Fishing)","Civ (Trade)","Civ (Transport)"]"
as this
"[\"Civ (Fishing)\",\"Civ (Trade)\",\"Civ (Transport)\"]"
Godot's str_to_var()
function translates it just fine to an array, and I was getting too worried about how the original imported data looked instead of checking if it actually worked. I must have been incorrectly calling it this whole time. :/
Upvotes: 1