• Need help with file.Read
    6 replies, posted
Hey, i just have a small question with file.Read! I made a serverside script which should read a txt file out of the servers data folder. I tried it like that: [CODE] local primary = file.Read( convert( ply:SteamID() ) .. "ld/" .. convert( ply:SteamID() ) .. "primary", "DATA" ) if primary == "p1" then //CODE end [/CODE] but i get errors that the value "primary" is nil. Can someone please explain me what i did wrong and maybe correct me? :) Thanks!
How are you writing into the file?
In a Derma with a button. The file is located in the servers data folder and the write process is fully working! [CODE] file.Write( "ld/" .. convert( ply:SteamID() ) .. "primary" .. ".txt", "p1" ) [/CODE] I just have problems to read the file.
[CODE] local primary = file.Read("ld/" .. convert( ply:SteamID() ) .. "primary.txt", "DATA" ) [/CODE]I'm on my phone. May be mistakes.
oh fu**, you're right! Thank you very much!!! :=) I will test this and set the thread as solved if it works :) [editline]29th April 2014[/editline] Error: attempt to index local 'primary' (a nil value) in line 361 Thats the line: [CODE]local primary = file.Read( "ld/" .. convert( ply:SteamID() ) .. "primary", "DATA" )[/CODE]
You forgot the .txt after primary.
oh my god...sorry for being a noob ^^ i am so tired :P //WORKS! --- Sorry for retardedness :DD
Sorry, you need to Log In to post a reply to this thread.