DarkRP Loading Weapons error

Inside of my job, everything is working perfectly!
But this: weapons = { file.Read( v…"/weapons.txt", “DATA” ) }, it loads into game but shows the weapons next to eachover. (On f4 menu). It is meant to show each weapon below it
like { “weapon_shotgun”, “weapon_crossbow” } <-- Code of it. But when I try that in a txt file load it doesn’t work! All I want to do is load all weapons. I have tried alot of string. mechanisms but never seems to work. Help please, and if there is any other way of displaying multiple values in a data file please show me! Thanks


TXT File
weapon_crossbow, weapon_shotgun


Lua File
	_G["TEAM_" .. string.upper( directories[k] )] = DarkRP.createJob( directories[k], {
			color = Color( 255,255,255,255 ) ,
			model = {
				tostring(file.Read( v.."/model.txt", "DATA" ))
			},
			description = file.Read( v.."/description.txt", "DATA" ),
			weapons = { file.Read( v.."/weapons.txt", "DATA" ) }, -- PROBLEM!!!
			command = tostring(directories[k]),
			max = tonumber(file.Read( v.."/max.txt", "DATA" )), -- at most 70% of the players can have this job. Set to a whole number to set an absolute limit.
			salary = tonumber(file.Read( v.."/salary.txt", "DATA" )),
			admin = tonumber(file.Read( v.."/admin.txt", "DATA" )),
			vote = tonumber(file.Read( v.."/vote.txt", "DATA" )),
			hasLicense = tonumber(file.Read( v.."/license.txt", "DATA" )),
			category = tostring(file.Read( v.."/category.txt", "DATA" )), -- The name of the category it is in. Note: the category must be created!
	})
	end

file.Read outputs a string, so what your code is essentially doing is this:
[lua]
weapons = { “weapon_blah, weapon_xyz” }, – which is clearly what you don’t want
[/lua]
When you’re saving the weapons, I recommend using

util.TableToJSON. That’ll allow you to convert your weapons table into a string, save it, and load it back as a table using

util.JSONToTable.

So it’ll look like this once you’re finished:
[lua]
weapons = util.JSONToTable( file.Read( v…"/weapons.txt", “DATA” ) ),
[/lua]

[editline]18th November 2016[/editline]

or you can

string.Explode the txt file using the separator ", " and just use that as the weapon table

This didn’t work. I used string.Explode and it didnt work.

it’ll most possibly load weapon_blah and " weapon_xyz" that doesn’t exists
I recommend you to use json system and serialize it in that way, you have to think outside of the box and understand how stuff works internally, if that doesn’t work, debug the most you can and then you’ll be able to find the answer, don’t keep with “Doesn’t work”, because you won’t get that far, never