I've got a comma-delimited file that I exported from Access that I'm trying to read, and split into table items. Problem is one of the fields contains multiple lines, and I'm not sure how to process it.
An example of one exported record from the database:
Now I'm hitting two problems. First, the code above isn't processing the multi-line records properly. Second, the commas in the strings for some of the fields causes unwanted splits when ran through utils.split. If using a different delimiter would be the easiest solution for the second problem, that's easily done...but I can't figure out how to get around the first. Any hints or suggestions?
This is for my attempt to make a dirty Zmud to MUSHclient mapper conversion script, which I'm more than happy to share when I finish.
An example of one exported record from the database:
34172,"The Hitching Post","","Flail Smith Guild","This is the local tavern. There are round tables up near the front, with
the bar at the back just in front of a small kitchen. Hefty mugs are set on
the bar top, large enough to quench a powerful thirst. There is a space
clear for dancing at the center of the tavern.
",0,-1,34172,0,-1200,-21840,0,0,0,0,0,0,0,11812261,-1,11,1,,,,0,,0,0,0,1/3/2006 19:29:31,114,-1,1/3/2006 19:29:31,0
local filename = utils.filepicker ("ObjectTbl File", "ObjectTbl.txt", "txt", { txt = "Text files", ["*"] = "All files" }, false)
if not filename then
return -- they cancelled
end
rooms = {}
local num = 0
for line in io.lines (filename) do
num = num + 1
line = string.gsub (line, '"', '')
rooms[num] = utils.split (line, ",")
end
Now I'm hitting two problems. First, the code above isn't processing the multi-line records properly. Second, the commas in the strings for some of the fields causes unwanted splits when ran through utils.split. If using a different delimiter would be the easiest solution for the second problem, that's easily done...but I can't figure out how to get around the first. Any hints or suggestions?
This is for my attempt to make a dirty Zmud to MUSHclient mapper conversion script, which I'm more than happy to share when I finish.