How to read/write from a txt file
Last read Never
I need a config file, a way of storing data generated server side and a way of importing a list of words from a txt file.
Please help guys I have no idea how to do this, wiki was no help.
Did you even bother to read the second line he wrote? lmao
I understood the second line as if he was not able to find the wiki pages for his problem, then I didn't understand it correctly, sorry about that.
I already had found the wiki page but I do not know how to use it.
-- DATA TO STORE
local myServerData = {
URL = "https://www.gmodstore.com/",
Language = "EN",
SomeInt = 5
}
-- WRITING DATA
local jsonString = util.TableToJSON( myServerData, true ) -- https://wiki.facepunch.com/gmod/util.TableToJSON
file.Write( "my_server_data.json", jsonString ) -- https://wiki.facepunch.com/gmod/file.Write
-- READING DATA
local fileContent = file.Read( "my_server_data.json", "DATA" ) -- https://wiki.facepunch.com/gmod/file.Read
local myTable = util.JSONToTable( fileContent ) -- https://wiki.facepunch.com/gmod/util.JSONToTable
thank you
Users viewing this thread
Nobody