• Files
    13 replies, posted
I need help writing data to txt files and creating the text files if needed. I want it to be in data folder, then inside another folder. Do I make multiple file.Write() or just 1?
If you want to put a text file inside a folder, just put the folder name as a part of the path and it will automatically be created. [lua]file.Write("YourDir/YourFile.txt")[/lua] Will automatically create a "YourDir" directory.
What if I just want to add onto the file and not re-write it?
[b][url=http://wiki.garrysmod.com/?title=Filex.Append]Filex.Append [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] :eng101:
-snip- [editline]05:16PM[/editline] Is is possible to take the text from a DTextEntry and remove all the new lines from it, so it is one big line.(even though it has multiple lines when it was originally typed) [editline]06:20PM[/editline] I am only testing my script, I haven't added it to my server, so how would I make it make the files on the servers data folder and not the clients folder.
you would need to use console commands, and for getting rid of newlines: string.gsub(<some string>, "\n", "") 500 posts heh
Explain more about how to make it create the file on the server and not the clients. Also I am having trouble getting my script to work. It is just derma and the txt files that it writes, where would I place things. I am a complete newb to lua.
If you want to create a file on the server, use [b][url=http://wiki.garrysmod.com/?title=File.Write]File.Write [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
[QUOTE=HeavyMtl123;21796411]If you want to create a file on the server, use [b][url=http://wiki.garrysmod.com/?title=File.Write]File.Write [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b][/QUOTE] You need to read the thread before you post. The OP knows how to write to a file, but he wants to know how to write a file to the server from a client.
How about someone answers my question for once?
Send the data to the server using concommands.
Use datastream instead of concommands: [url]http://wiki.garrysmod.com/?title=Datastream[/url]
[QUOTE=nicatronTg;21798753]Use datastream instead of concommands: [url]http://wiki.garrysmod.com/?title=Datastream[/url][/QUOTE] Datastream uses concommands.
snip
Sorry, you need to Log In to post a reply to this thread.