Help with TableToJSON

-rem-

No need to keep creating topics… This one explains it: http://forum.facepunch.com/showthread.php?t=1395921&p=44886685&viewfull=1#post44886685

You need to read the data from the file, modify it to your liking, then save the updated table to avoid losing data.

[LUA]
//Your starting table for example
fuckentable = {
Variable = “chicken”,
Number = 228,
WhateverVariableUWant = “Flying Potato”
}
//Place where your table variables will be changed
local _file = “test/” … ply:UniqueID( ) … “.txt”
local oldtable = util.JSONToTable(file.Read(_file, “DATA”))
oldtable.Variable = “Cock”
oldtable.Number = 1488
file.Write ( _file, util.TableToJSON(_table) )
//What will table contains at the end(what will be printed in console if you will do PrintTable after changing function)
fuckentable = {
Variable = “Cock”,
Number = 1488,
WhateveVariableUWant = “Flying Potato”//It’s still the same cos we haven’t changed it in changing function
}
[/LUA]