Command to get all spawned entties of type.

Hey im using the slasher gamemode and they using for spawning the entities that formatting:


Generator = {
		{type="sls_generator", pos=Vector( 	-230.557007, 567.435425, 0.243941	 ), ang=Angle(	-0.104, 179.841, 0.022	),spw=false,},
		{type="sls_generator", pos=Vector( -3185.97,1998.87,-255.78 ), ang=Angle( -0.082,-88.412,-0.005 ),spw=false,},
		{type="sls_generator", pos=Vector( 	1631.988892, 3082.173340, -39.728069	 ), ang=Angle(	-0.082, 89.379, 0.005	),spw=false,},
	},

This code is not automatic generated its copy paste and checking the entity coordinates…

How is a formatting like this possible?


for k, v in pairs( ents.FindByClass( "item_ammo_357" ) ) do
	
		Ammo[k] = {type=v:GetClass(), pos=Vector(v:GetPos()), ang=Angle(v:GetAngles()), spw=false } 

	end
	
	local str = util.TableToJSON(Ammo)
	file.Write( "slasherentities.txt", str )

The code output is:


[{"type":"item_ammo_357","pos":"[740.8759 340.879 -143.5764]","spw":false,"ang":"{1.0209 -0.0286 -0.6623}"},

but for copy paste the right formatting into the lua for slasher i need to make the formatting like the upper example… I know JSON to TABLE could help but idk how to use it properly

thanks alot.

THE GITHUB REPO https://github.com/Garrus2142/Slashers/