• Help with fileRead() and fileFind() with .txt and Data folder
    2 replies, posted
Hello guys I understand how fileRead() and fileFind() in terms of .lua files in the LUA directory, however, for some reason when I try with .txt files in the DATA folder I'm having issues finding and reading from the file. My .txt file location is at: ...garrysmod/addons/[addon name]/data/fileiwant.txt fileiwant.txt contents are: "Hello." What I've attempted in order to find / read from the file : [code] --Method 1: Locate the file local files, directories = file.Find( "*", "DATA" ) PrintTable( files ) -- Shows a table of files that does not include fileiwant.txt --Method 2: reading from fileiwant.txt directly local Data = file.Read( "fileiwant.txt", "DATA" ) print ( Data ) -- Prints nil rather than "Hello." likely because it isn't found. [/code] Does the .txt file have to be downloaded by the client? Am I just not placing it/seeking it correctly?
[QUOTE=Holywiremod;51557977]Hello guys I understand how fileRead() and fileFind() in terms of .lua files in the LUA directory, however, for some reason when I try with .txt files in the DATA folder I'm having issues finding and reading from the file. My .txt file location is at: ...garrysmod/addons/[addon name]/data/fileiwant.txt fileiwant.txt contents are: "Hello." What I've attempted in order to find / read from the file : [code] --Method 1: Locate the file local files, directories = file.Find( "*", "DATA" ) PrintTable( files ) -- Shows a table of files that does not include fileiwant.txt --Method 2: reading from fileiwant.txt directly local Data = file.Read( "fileiwant.txt", "DATA" ) print ( Data ) -- Prints nil rather than "Hello." likely because it isn't found. [/code] Does the .txt file have to be downloaded by the client? Am I just not placing it/seeking it correctly?[/QUOTE] The data isn't stored in your Addon Data, it's stored in your server data. Garrysmod/data
[QUOTE=FlyPiggyBanks;51558186]The data isn't stored in your Addon Data, it's stored in your server data. Garrysmod/data[/QUOTE] Thank you! Everything is looking good.
Sorry, you need to Log In to post a reply to this thread.