Forum

> > CS2D > Scripts > WTF working with files
Forums overviewCS2D overview Scripts overviewLog in to reply

English WTF working with files

4 replies
To the start Previous 1 Next To the start

old WTF working with files

Ultimate programmer
BANNED Off Offline

Quote
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 ?

old Re: WTF working with files

VADemon
User Off Offline

Quote
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
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview