Forum

> > CS2D > Scripts > WTF working with files
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch WTF working with files

4 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt WTF working with files

Ultimate programmer
BANNED Off Offline

Zitieren
I write this code:

file=io.open ("sys/lua/fil.txt","r")
     if(file==nil)then
     print("can not open fil.txt")
     else
     data=file:read()
          if(data==nil)then
          print("error")
          end
     end

and it do not say:"can not open fil.txt" but say "error",wtf,why it can not read it ?

alt Re: WTF working with files

VADemon
User Off Offline

Zitieren
You don't even need the "if file==nil then"
1
2
3
4
5
6
sample = 1
if sample then
print(sample)
else
print("Sample equals nil!")
end
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht