thanks
[Lua] Can you program this for me?
Started by mibac138, Nov 25 2012 06:58 AM
7 replies to this topic
#1
Posted 25 November 2012 - 06:58 AM
if example-file exist then
thanks
/>
thanks
#2
Posted 25 November 2012 - 07:16 AM
local file = fs.open('somefile','r')
if file then
local filecontents = file.readAll()
file.close()
end
Something like this?Or if you just wanted to see if a file exists:
if fs.exists('somefile') then
-- stuff
end
#3
Posted 25 November 2012 - 07:28 AM
code number 2 but what doing code number 1 ?
#4
Posted 25 November 2012 - 07:30 AM
The first one is reading files.
#5
Posted 25 November 2012 - 07:30 AM
thanks
/>
#6
Posted 25 November 2012 - 07:43 AM
oh, i forgot how to do if example-file dont exist then
example-file create
example-file create
#7
Posted 25 November 2012 - 08:00 AM
You can't create a file directly, but you can use fs.open('somefile','w')
local filename = 'somefile' if not fs.exists(filename) then fs.open(filename, 'w') fs.close(filename) end
#8
Posted 25 November 2012 - 08:03 AM
thanks again
/>
2 user(s) are reading this topic
0 members, 2 guests, 0 anonymous users











