Jump to content




how do you edit a file using fs api?


  • You cannot reply to this topic
2 replies to this topic

#1 thegreatstudio

  • Banned
  • 164 posts
  • LocationI am on your computer

Posted 01 May 2013 - 10:59 AM

because i have a program that uses fs api but i dont know how it use it to edit programs.. like startups, programms and more

#2 remiX

  • Members
  • 2,076 posts
  • LocationSouth Africa

Posted 01 May 2013 - 11:04 AM

To open a file, clear it and then write use "w" mode
local file = fs.open("startup", "w")
file.write([[--Use multi string lines
--for it to be

--spread over
--multiple lines

print("hi")]])
file.close()

Use "a" mode to append to the file.
local file = fs.open("startup", "a")
file.write([[--This text
--should be found at the end of the startup file
print("Appended successfully!")]])
file.close()


#3 thegreatstudio

  • Banned
  • 164 posts
  • LocationI am on your computer

Posted 01 May 2013 - 11:23 AM

View PostremiX, on 01 May 2013 - 11:04 AM, said:

To open a file, clear it and then write use "w" mode
local file = fs.open("startup", "w")
file.write([[--Use multi string lines
--for it to be

--spread over
--multiple lines

print("hi")]])
file.close()

Use "a" mode to append to the file.
local file = fs.open("startup", "a")
file.write([[--This text
--should be found at the end of the startup file
print("Appended successfully!")]])
file.close()

you are a great help remix! Thanks for your answer :)





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users